Do I need to create a bug ticket for that? Or is it now already known? :-)

Thank you very much again for your help.

Benjamin

-----Ursprüngliche Nachricht-----
Von: Carl Kleffner [mailto:cmkleff...@gmail.com] 
Gesendet: Donnerstag, 6. Mai 2021 16:50
An: mingw-w64-public@lists.sourceforge.net
Betreff: Re: [Mingw-w64-public] Setting Floating-Point Operation Precision 
Changes With Gcc 10.3

It seems that the commit "winpthreads: Call _fpreset() for new threads"
from aug 2020 makes threads consistent with the build default, not with the 
users default instead. I would call it a bug, as this is unexpected and does 
not fit the usual recommendation to link CRT-fp8.o for the case that
53 bit precision is wanted by the user. The only workaround in this setting is 
to statically link winpthreads.

Carl

Am Do., 6. Mai 2021 um 16:33 Uhr schrieb Benjamin Bihler <
benjamin.bih...@compositence.de>:

> With static builds and mingw-w64 v7 I get the following:
> - Linking neither CRT_fp8.0 nor CRT_fp10.o : inconsistent behaviour
> - Linking CRT_fp8.o: consistent behaviour
> - Linking CRT_fp10.o: inconsistent behaviour
>
> (no change)
>
> With static builds and mingw-w64 v8 I get the following:
> - Linking neither CRT_fp8.0 nor CRT_fp10.o : consistent behaviour
> - Linking CRT_fp8.o: consistent behaviour
> - Linking CRT_fp10.o: consistent behaviour
>
> (behaviour is always consistent now)
>
> Now of course the behaviour doesn't change anymore, when I have 
> another libwinpthread-1.dll in the path!
>
> This already helps me a lot. Thank you for your research. But I guess 
> that this is not perfect yet, is it?
>
> Benjamin
>
> -----Ursprüngliche Nachricht-----
> Von: Carl Kleffner [mailto:cmkleff...@gmail.com]
> Gesendet: Donnerstag, 6. Mai 2021 15:59
> An: mingw-w64-public@lists.sourceforge.net
> Betreff: Re: [Mingw-w64-public] Setting Floating-Point Operation 
> Precision Changes With Gcc 10.3
>
>  Please tryout a static build using `-static` and test again.
> I also performed some tests and guess, that the consistency patch (in 
> v8 but not v7) guarantees the thread has extended precision if you use 
> libwinpthreads.dll. In case of using static build libwinpthreads.a 
> this patch would not apply.
>
> Am Do., 6. Mai 2021 um 15:55 Uhr schrieb Benjamin Bihler <
> benjamin.bih...@compositence.de>:
>
> > I have checked it, the patch 295fafc is included in v8 of mingw-w64 
> > when building the compiler with mingw-builds. But does the patch help?
> > Or is it actually buggy in the sense that it makes the compilation 
> > results behave different from the documentation in float.h?
> >
> > Benjamin
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Carl Kleffner [mailto:cmkleff...@gmail.com]
> > Gesendet: Donnerstag, 6. Mai 2021 14:38
> > An: mingw-w64-public@lists.sourceforge.net
> > Betreff: Re: [Mingw-w64-public] Setting Floating-Point Operation 
> > Precision Changes With Gcc 10.3
> >
> > You can set the FPU precision for the main thread by linking 
> > CRT_fp8.o or CRT_f10.o. Extended precision is the default for most 
> > mingw-w64 based toolchains as the math library used in mingw-w64 is 
> > based on this. The question is: what happens when a new thread is started?.
> >
> > Answer: Windows starts new threads NEVER with extended precision, 
> > because double precision is the default for MS VS Studio and the 
> > Win32
> API.
> >
> > To get consistent behaviour inside a mingw-w64 based project the FPU 
> > precision must be coded consistently by the programmer itself. Or 
> > you have to use the patch 
> > https://sourceforge.net/p/mingw-w64/mingw-w64/ci/295fafc
> > :
> > consistent behaviour will be guaranteed automatically at least for 
> > pthreads. I guess this patch is not included in the v8 of mingw-w64.
> >
> > If you are not sure what is happening use:
> > https://github.com/jevinskie/fpudump to print out the FPU state 
> > anywhere in your program. It may only work with C, but not with C++ 
> > programs, but I'm not sure.
> >
> > Am Do., 6. Mai 2021 um 10:11 Uhr schrieb Benjamin Bihler <
> > benjamin.bih...@compositence.de>:
> >
> > > It may have to do something with the commit you have mentioned. I 
> > > am not sure... I am a compiler end user, not a compiler developer. 
> > > What does that mean? That linking CRT_fp8 or CRT_fp10 is not the 
> > > right way anymore to set
> > > x87 precision?
> > >
> > > Benjamin
> > >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Liu Hao [mailto:lh_mo...@126.com]
> > > Gesendet: Dienstag, 4. Mai 2021 16:56
> > > An: mingw-w64-public@lists.sourceforge.net; Carl Kleffner < 
> > > cmkleff...@gmail.com>
> > > Betreff: Re: [Mingw-w64-public] Setting Floating-Point Operation 
> > > Precision Changes With Gcc 10.3
> > >
> > > 在 2021-05-04 22:46, Carl Kleffner 写道:
> > > > I can't reproduce this behaviour. With gcc-10.3 on msys2/ucrt64 
> > > > as well
> > > as
> > > > msy2/mingw64 I get consistent results, regardless if I link 
> > > > CRT_fp10.o, CRT_fp8.o or none of them.
> > > >
> > > >
> > >
> > > Does it have something to do with
> > > https://sourceforge.net/p/mingw-w64/mingw-w64/ci/295fafc?
> > >
> > >
> > > --
> > > Best regards,
> > > Liu Hao
> > >
> > >
> > > _______________________________________________
> > > Mingw-w64-public mailing list
> > > Mingw-w64-public@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
> > >
> >
> > _______________________________________________
> > Mingw-w64-public mailing list
> > Mingw-w64-public@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
> >
> > _______________________________________________
> > Mingw-w64-public mailing list
> > Mingw-w64-public@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
> >
>
> _______________________________________________
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
> _______________________________________________
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to