The test raises SIGBUS at run time: Starting program: /1/ebotcazou/build/ieee_6 Program received signal SIGBUS, Bus error. __GI___fegetenv (envp=0x7fefffff14c) at ../sysdeps/sparc/fpu/fegetenv.c:25 25 ../sysdeps/sparc/fpu/fegetenv.c: No such file or directory. (gdb) bt #0 __GI___fegetenv (envp=0x7fefffff14c) at ../sysdeps/sparc/fpu/fegetenv.c:25 #1 0x0000000000100c68 in MAIN__ () at ieee_6.f90:23 because envp is not a multiple of 8. On this platform, fenv_t is defined as: /* Type representing floating-point environment. */ typedef unsigned long int fenv_t; so fegetenv expects an address multiple of 8 (the size of 'long'). The problematic Fortran type is apparently declared in ieee_exceptions.F90: type, public :: IEEE_STATUS_TYPE private character(len=GFC_FPE_STATE_BUFFER_SIZE) :: hidden end type with the GFC_FPE_STATE_BUFFER_SIZE parameter coming from libgfortran.h: /* Size of the buffer required to store FPU state for any target. In particular, this has to be larger than fenv_t on all glibc targets. Currently, the winner is x86_64 with 32 bytes. */ #define GFC_FPE_STATE_BUFFER_SIZE 32 This obviously overlooks alignment constraints.
Target issue?
Still present. The type really needs to be properly aligned...
Created attachment 52084 [details] Tentative patch
Specifying specific alignment in Fortran code is not directly possibly, sadly. The only way I see how of this is to make that variable an integer, instead of char array. Eric, could you kindly test the patch attached, and let me know if it fixes gfortran.dg/ieee/ieee_6.f90? Does it introduce any other failure? I am wondering if this is breaking libgfortran ABI. I think not, but not 100% sure.
> Eric, could you kindly test the patch attached, and let me know if it fixes > gfortran.dg/ieee/ieee_6.f90? Does it introduce any other failure? The SPARC64/Linux machine of the Compile Farm apparently has network issues.
I get this compilation error: In file included from /home/ebotcazou/src/libgfortran/runtime/fpu.c:29: ./fpu-target.h:36:24: error: invalid application of 'sizeof' to incomplete type 'struct fenv' 36 | _Static_assert (sizeof(struct fenv) <= 8 * GFC_FPE_STATE_INT_KIND, | ^~~~~~ ./fpu-target.h:36:17: error: expression in static assertion is not an integer 36 | _Static_assert (sizeof(struct fenv) <= 8 * GFC_FPE_STATE_INT_KIND, | ^~~~~~ make[2]: *** [Makefile:3071: fpu.lo] Error 1 make[2]: Leaving directory '/home/ebotcazou/build/sparc64-linux-gnu/libgfortran' make[1]: *** [Makefile:1692: all] Error 2 make[1]: Leaving directory '/home/ebotcazou/build/sparc64-linux-gnu/libgfortran' make: *** [Makefile:23173: all-target-libgfortran] Error 2
GCC 12.1 is being released, retargeting bugs to GCC 12.2.
GCC 12.2 is being released, retargeting bugs to GCC 12.3.
GCC 12.3 is being released, retargeting bugs to GCC 12.4.
GCC 12.4 is being released, retargeting bugs to GCC 12.5.