Re: [fpc-pascal] Arguments gets corrupted with anonymous nested function

2022-09-07 Thread Jonas Maebe via fpc-pascal
On 2022-09-07 17:09, Benito van der Zander via fpc-pascal wrote: Hi, https://gitlab.com/freepascal.org/fpc/source/-/issues/38703 I'm afraid that with -O4 it is by design. -O4 enables -OoUNCERTAIN, and the documentation about -OoUNCERTAIN notes that: "If uncertain optimizations are enable

Re: [fpc-pascal] Arguments gets corrupted with anonymous nested function

2022-09-07 Thread Benito van der Zander via fpc-pascal
Hi, https://gitlab.com/freepascal.org/fpc/source/-/issues/38703 I'm afraid that with -O4 it is by design. -O4 enables -OoUNCERTAIN, and the documentation about -OoUNCERTAIN notes that: “If uncertain optimizations are enabled, the CSE algorithm assumes that — If something is written to a lo

Re: [fpc-pascal] Arguments gets corrupted with anonymous nested function

2022-09-07 Thread Sven Barth via fpc-pascal
Peter B via fpc-pascal schrieb am Mi., 7. Sep. 2022, 13:58: > I'm wondering if this is related to > https://gitlab.com/freepascal.org/fpc/source/-/issues/38703 > > That caused a parameter corruption in a standard function. > https://lists.freepascal.org/pipermail/fpc-pascal/2022-March/060361.html

Re: [fpc-pascal] Arguments gets corrupted with anonymous nested function

2022-09-07 Thread Peter B via fpc-pascal
I'm wondering if this is related to https://gitlab.com/freepascal.org/fpc/source/-/issues/38703 That caused a parameter corruption in a standard function. https://lists.freepascal.org/pipermail/fpc-pascal/2022-March/060361.html Should be easy to check. Just try compiling with -O1 Cheers, Peter

Re: [fpc-pascal] Arguments gets corrupted with anonymous nested function

2022-09-05 Thread Sven Barth via fpc-pascal
Am 04.09.2022 um 22:05 schrieb Hairy Pixels: On Sep 4, 2022, at 1:36 PM, Sven Barth wrote: Does this also happen if you don't use a class? Otherwise it might be related with the other error you already reported. But report this anyway, I'll simply mark it as duplicate if necessary... I on

Re: [fpc-pascal] Arguments gets corrupted with anonymous nested function

2022-09-04 Thread Hairy Pixels via fpc-pascal
> On Sep 4, 2022, at 1:36 PM, Sven Barth wrote: > > Does this also happen if you don't use a class? Otherwise it might be related > with the other error you already reported. But report this anyway, I'll > simply mark it as duplicate if necessary... > I only reproduced using a class with g

Re: [fpc-pascal] Arguments gets corrupted with anonymous nested function

2022-09-04 Thread Sven Barth via fpc-pascal
Hairy Pixels via fpc-pascal schrieb am So., 4. Sep. 2022, 18:07: > The following program uses an anonymous nested function which captures a > local variable. It seems the arguments get corrupted (likely because of the > hidden first param for the nested function signature) and prints garbled > da

[fpc-pascal] Arguments gets corrupted with anonymous nested function

2022-09-04 Thread Hairy Pixels via fpc-pascal
The following program uses an anonymous nested function which captures a local variable. It seems the arguments get corrupted (likely because of the hidden first param for the nested function signature) and prints garbled data. I reduced this snippet down from another project but I’m not sure if