On Tue, 14 Sep 2021, Tobias Burnus wrote: > And, related, does the following make sense and fixes the issue? > > --- a/libgfortran/ISO_Fortran_binding.h > +++ b/libgfortran/ISO_Fortran_binding.h > @@ -228,5 +228,5 @@ extern int CFI_setpointer (CFI_cdesc_t *, CFI_cdesc_t *, > const CFI_index_t []); > > /* This is the 80-bit encoding on x86; Fortran assigns it kind 10. */ > -#elif (LDBL_MANT_DIG == 64 \ > +#elif ((LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 53) \ > && LDBL_MIN_EXP == -16381 \ > && LDBL_MAX_EXP == 16384)
Yes, with this patch (on top of current trunk) i586-freebsd-* is back in bootstrap land. :) On Tue, 14 Sep 2021, Jakub Jelinek wrote: >> That looks like range of extended float, but rounded to double float >> precision. > Yeah. > real.c has: > /* The following caters to i386 systems that set the rounding precision > to 53 bits instead of 64, e.g. FreeBSD. */ > const struct real_format ieee_extended_intel_96_round_53_format = > But, wonder why it didn't work with the float.h include then, because > https://github.com/lattera/freebsd/blob/master/sys/x86/include/float.h > seems to define LDBL_MANT_DIG to 64, LDBL_MIN_EXP to (-16381) and > LDBL_MAX_EXP to 16384 and that case was handled in ISO_Fortran_binding.h. A friendly soul reminded me off-list "that on i585-*-freebsd, the FPU is put into a mode where long double has only 53 bits of precision instead of 64 bits. [ /usr/include/x86/fpu.h has ] /* * The hardware default control word for i387's and later coprocessors is * 0x37F, giving: * * round to nearest * 64-bit precision * all exceptions masked. * * FreeBSD/i386 uses 53 bit precision for things like fadd/fsub/fsqrt etc * because of the difference between memory and fpu register stack arguments. * If its using an intermediate fpu register, it has 80/64 bits to work * with. If it uses memory, it has 64/53 bits to work with. However, * gcc is aware of this and goes to a fair bit of trouble to make the * best use of it. * * This is mostly academic for AMD64, because the ABI prefers the use * SSE2 based math. For FreeBSD/amd64, we go with the default settings. */ #define __INITIAL_FPUCW__ 0x037F #define __INITIAL_FPUCW_I386__ 0x127F #define __INITIAL_NPXCW__ __INITIAL_FPUCW_I386__ #define __INITIAL_MXCSR__ 0x1F80 #define __INITIAL_MXCSR_MASK__ 0xFFBF " (end quote) Thanks for looking into this together! Gerald