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 enabled, the CSE algorithm assumes 
that
-- If something is written to a local/global register or a 
procedure/function parameter, this value doesn't overwrite the value 
to which a pointer points.
-- If something is written to memory pointed to by a pointer variable, 
this value doesn't overwrite the value of a local/global variable or a 
procedure/function parameter."


is it doing that? did it ever do that?


It did that when the old assembler-level CSE optimiser still existed. 
It's been removed for a long time now.



Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


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 local/global register or a 
procedure/function parameter, this value doesn’t overwrite the value 
to which a pointer points.
— If something is written to memory pointed to by a pointer variable, 
this value doesn’t overwrite the value of a local/global variable or a 
procedure/function parameter.”




is it doing that? did it ever do that? It might break a lot of my code

But I cannot find any place in FPC where it is doing any OoUNCERTAIN 
optimizations


Best,
Benito
On 07.09.22 13:51, Peter B via fpc-pascal wrote:

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
___
fpc-pascal maillist  - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] reading a TFPGMap from several threads

2022-09-07 Thread Luca Olivetti via fpc-pascal

El 7/9/22 a les 14:12, Sven Barth via fpc-pascal ha escrit:
Luca Olivetti via fpc-pascal > schrieb am Mi., 7. Sep. 2022, 
13:01:


Hello,

I have a couple of TFPGMaps that I populate once and never change.
Is it safe to read them (i.e. use Find and Data[]) from different
threads?
I'd avoid using a critical section if not absolutely necessary.


I'd say that this should be safe indeed.


Ok, thank you.

Bye
--
Luca
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] reading a TFPGMap from several threads

2022-09-07 Thread Sven Barth via fpc-pascal
Luca Olivetti via fpc-pascal  schrieb am
Mi., 7. Sep. 2022, 13:01:

> Hello,
>
> I have a couple of TFPGMaps that I populate once and never change.
> Is it safe to read them (i.e. use Find and Data[]) from different threads?
> I'd avoid using a critical section if not absolutely necessary.
>

I'd say that this should be safe indeed.

Regards,
Sven

>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


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
>
> Should be easy to check. Just try compiling with -O1
>

It's more likely (and also known!) that the compiler has a problem when
converting anonymous and/or nested functions.

Regards,
Sven

>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


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
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] reading a TFPGMap from several threads

2022-09-07 Thread Luca Olivetti via fpc-pascal

Hello,

I have a couple of TFPGMaps that I populate once and never change.
Is it safe to read them (i.e. use Find and Data[]) from different threads?
I'd avoid using a critical section if not absolutely necessary.

Bye

--
Luca
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal