If I ran it in Lazarus I get same result as Okoba.
If I compile it with with ppc386 or ppcx64 or run it in Lazarus without debugging (Shift+Ctrl+F9) I get correct results.
It looks like Lazarus bug.
In Lazarus it doesn't matter if all debugging options are turned off, it must be run without debugging.
Windows 11, FPC 3.2.2, Lazarus 3.6.
Okoba, next time write details of your environment, it will be easier for others to test.