AArch64 -O2 bug not seen with -O1
Original Reporter info from Mantis: crlab @neurolabusc1
-
Reporter name: Chris Rorden
Original Reporter info from Mantis: crlab @neurolabusc1
- Reporter name: Chris Rorden
Description:
Compiling the example software with -O2 reports a bogus value for variable fsz:
fpc -O2 fsz.pas; ls -l dipso002.tif; ./fsz dipso002.tif
But same code works when compiled as -O1. In this example, removing the unused variable "ok1" resolves the problem. Things seem to get confused when there are too many variables being juggled.
Steps to reproduce:
Incorrect file size reported when compiled with -O2:
$fpc -O2 fsz.pas; ls -l dipso002.tif; ./fsz dipso002.tif
Free Pascal Compiler version 3.3.1 [2020/11/07] for aarch64
Copyright (c) 1993-2020 by Florian Klaempfl and others
Target OS: Darwin for AArch64
Compiling fsz.pas
fsz.pas(80,11) Note: Local variable "ok1" not used
Assembling fsz
Linking fsz
264 lines compiled, 0.2 sec
1 note(s) issued
-rw-r--r--@ 1 chris staff 1050090 Oct 4 2016 dipso002.tif
1050090
Filesize 1050090
1050090
TIFF Filesize 248984
ReportTiff Error:IFDstart offset (1048584) exceeds filesize (248984)
Correct file size reported when compiled with -O1:
$fpc -O1 fsz.pas; ls -l dipso002.tif; ./fsz dipso002.tif
Free Pascal Compiler version 3.3.1 [2020/11/07] for aarch64
Copyright (c) 1993-2020 by Florian Klaempfl and others
Target OS: Darwin for AArch64
Compiling fsz.pas
fsz.pas(80,11) Note: Local variable "ok1" not used
Assembling fsz
Linking fsz
264 lines compiled, 0.2 sec
1 note(s) issued
-rw-r--r--@ 1 chris staff 1050090 Oct 4 2016 dipso002.tif
1050090
Filesize 1050090
1050090
TIFF Filesize 1050090
ReportTiff: OK
Mantis conversion info:
- Mantis ID: 38053
- OS: Darwin
- OS Build: 11.0.1 Beta
- Build: 47351
- Platform: Apple Developer Transition Kit
- Version: 3.3.1
- Fixed in version: 3.2.2
- Fixed in revision: 49206 (#4b4ae796), 49207 (#bb977b39) - 49208 (#7ed1ba7a)
- Monitored by: » @neurolabusc1 (Chris Rorden), » @trevoz (Trevor Roydhouse)
- Target version: 3.2.2