Forum > FPC development

Bug in FPC optimization (aoptx86.pas)

(1/1)

noname01:
Hi,
I'm sorry but I don't have a gitlab account,
so I report a bug I found in this commit of FPC Source:

https://gitlab.com/freepascal.org/fpc/source/-/commit/4d33e5f137bce78e1d14a02cee370fd42e6adebe

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

AlexTP:
Posted to https://gitlab.com/freepascal.org/fpc/source/-/issues/40401

Navigation

[0] Message Index

Go to full version