Hi Gerald,
I note:
On 13.09.21 17:56, Gerald Pfeifer wrote:
% egrep -r '#define.*LDBL_(MANT_DIG|MIN_EXP|MAX_EXP)'/usr/include/
/usr/include/x86/float.h:#define LDBL_MANT_DIG 64
/usr/include/x86/float.h:#define LDBL_MIN_EXP (-16381)
/usr/include/x86/float.h:#define LDBL_MAX_EXP 16384
This looks like it matches existing Linux case already in place?
On 14.09.21 16:50, Gerald Pfeifer wrote:
On Mon, 13 Sep 2021, Tobias Burnus wrote:
Can you run 'echo | cpp -E -g3|grep DBL' to (or in the build dir: echo |
./gcc/cc1 -E -g3 -dD|grep DBL) to check what's the output?
Thank you, Tobias, and I'm just testing the proposed patch, but still
wanted to follow up on your question:
% echo | ./gcc/cc1 -E -g3 -dD | grep DBL
#define __DBL_MANT_DIG__ 53
#define __DBL_MIN_EXP__ (-1021)
#define __DBL_MAX_EXP__ 1024
#define __LDBL_MANT_DIG__ 53
#define __LDBL_MIN_EXP__ (-16381)
#define __LDBL_MAX_EXP__ 16384
I note that LDBL_MANT_DIG is 53 as for "double" – while Linux
and your header file has 64. On the other hand, MIN/MAX_EXP for
"long double" are larger than "double" – and match the values
from Linux and the size in your header file.
Thus, the first question is: why does DBL_MANT_DIG differ (64 vs. 53)?
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)
Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634
München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas
Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht
München, HRB 106955