> So that a copy of *FE_DFL_ENV still selects the default environment
> rather than unmasking every exception, make __mingw_fe_dfl_env hold the
> real encoding of the startup environment on x86 (x87 control word
> 0x037f, MXCSR 0x1f80), which is what fegetenv() returns in that state.
...
> /* The FE_DFL_ENV macro is required by standard.
> - fesetenv will use the environment set at app startup.*/
> + fesetenv recognizes it by address and installs the environment set at
> + app startup. On x86 its contents also encode that environment (x87
> + control word 0x037f, MXCSR 0x1f80), so a copy of it means the same. */
> +#if defined(__i386__) || defined(__x86_64__)
> +const fenv_t __mingw_fe_dfl_env = { 0x3f3f003f, 0 };
> +#else
> const fenv_t __mingw_fe_dfl_env = { 0, 0 };
> +#endif
This copy of *FE_DFL_ENV will not work and will break mingw-w64
applications which are linked with CRT_fp8.o object file which changes
the default precision from 10-byte to 8-byte.
The default precision is not 10-byte, but rather defined which _fpreset
function is statically linked into the exe, CRT_fp8.o or CRT_fp10.o.
By default is linked CRT_fp10.o
I think that this needs more work. What about moving the
__mingw_fe_dfl_env definition into the CRT_fp??.c files?
Then the copy of *FE_DFL_ENV would work also for applications linked
with CRT_fp8.o which have 8-byte default precision.
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public