Regression in FPC optimization (aoptx86.pas)
by forum user 'noname01'.
Free Pascal Compiler version 3.3.1 [2023/08/15] for x86_64.
I report a bug I found in this commit of FPC Source:
The optimization with -O3 produces a bad output of my file test.pp. Attached you find the file test.pp you so you can reproduce the bug. Thanks in advance.
E:\lazarus\fpc\bin\x86_64-win64>fpc -O2 E:\test.pp
Free Pascal Compiler version 3.3.1 [2023/08/15] for x86_64
Copyright (c) 1993-2023 by Florian Klaempfl and others
Target OS: Win64 for x64
Compiling E:\test.pp
Linking E:\test.exe
69 lines compiled, 0.1 sec, 34336 bytes code, 1604 bytes data
E:\lazarus\fpc\bin\x86_64-win64>E:\test.exe
186059610
E:\lazarus\fpc\bin\x86_64-win64>fpc -O3 E:\test.pp
Free Pascal Compiler version 3.3.1 [2023/08/15] for x86_64
Copyright (c) 1993-2023 by Florian Klaempfl and others
Target OS: Win64 for x64
Compiling E:\test.pp
Linking E:\test.exe
69 lines compiled, 0.1 sec, 34320 bytes code, 1604 bytes data
E:\lazarus\fpc\bin\x86_64-win64>E:\test.exe
206031441
Error: the correct value is 186059610
Edited by Alexey Torgashin