Unfortunately, executing the program produced a strange error message.
Assertion failed: sizeof(my_fenv_t) <= (size_t) GFC_FPE_STATE_BUFFER_SIZE, file ./fpu-target.h, line 434
It looks like on mingw the my_fenv_t struct in libgfortran/config/fpu-387.h has larger size than it should. It probably is the alignment of bitfields __opcode and __unused4. Since we don’t actually access those, the following patch should restore the proper structure size/alignment. Could you check for me? I’ll also check it on x86_64-apple-darwin, and if both go okay, I’ll commit it ASAP.
Given that it doesn’t break anything on x86_64-apple-darwin (which also uses fpu-387.h), and it should fix mingw (I’ve separately tested the new struct size with a cross-compiler), I’ve now committed the patch as revision 212126.
In addition to your sample, you can find new testsuite files in gcc/testsuite/gfortran.dg/ieee directory. See inside as one of them requires special options (like -ffree-line-length-none -O0).
If you could test your original example with the new version, and also run the tests in the gcc/testsuite/gfortran.dg/ieee directory, that’d be really great. Many thanks again!
FX