Bad code generation under -O4
Original Reporter info from Mantis: mftq75
-
Reporter name: C Western
Original Reporter info from Mantis: mftq75
- Reporter name: C Western
Description:
var
A: Double = 0.0001;
B: Double = 0;
begin
if B >= 0 then
A := B;
WriteLn(A); { Writes 1e-4 under -O4, should be 0 }
end.
Steps to reproduce:
$ fpc t.pas
Free Pascal Compiler version 3.3.1 [2020/12/23] for x86_64
Copyright (c) 1993-2020 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling t.pas
Linking t
11 lines compiled, 0.1 sec, 147216 bytes code, 56680 bytes data
$ ./t
0.0000000000000000E+000
$ fpc -O4 t.pas
Free Pascal Compiler version 3.3.1 [2020/12/23] for x86_64
Copyright (c) 1993-2020 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling t.pas
Linking t
11 lines compiled, 0.1 sec, 147200 bytes code, 56680 bytes data
$ ./t
1.0000000000000000E-004
Additional information:
Same result under linux and Windows
Mantis conversion info:
- Mantis ID: 38249
- Platform: x86_64
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 47843 (#6db164c9)