aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/iso-c-binding.def
diff options
context:
space:
mode:
authorSandra Loosemore <sandra@codesourcery.com>2021-08-03 16:21:16 -0700
committerSandra Loosemore <sandra@codesourcery.com>2021-08-11 07:36:55 -0700
commit58340a7cd3670024bafdbbc6ca63a9af841df98a (patch)
treea96a3c8677e30e3d5d7a5391f20fdcb9bd94b743 /gcc/fortran/iso-c-binding.def
parentcba64d855df581cc26fa487162027138aef4dbe5 (diff)
downloadgcc-58340a7cd3670024bafdbbc6ca63a9af841df98a.zip
gcc-58340a7cd3670024bafdbbc6ca63a9af841df98a.tar.gz
gcc-58340a7cd3670024bafdbbc6ca63a9af841df98a.tar.bz2
Fortran: Fix c_float128 and c_float128_complex definitions.
gfc_float128_type_node is only non-NULL on targets that support a 128-bit type that is not long double. Use float128_type_node instead when computing the value of the kind constants c_float128 and c_float128_complex from the ISO_C_BINDING intrinsic module; this also ensures it actually corresponds to __float128 (the IEEE encoding) and not some other 128-bit floating-point type. 2021-08-11 Sandra Loosemore <sandra@codesourcery.com> gcc/fortran/ * iso-c-binding.def (c_float128, c_float128_complex): Check float128_type_node instead of gfc_float128_type_node. * trans-types.c (gfc_init_kinds, gfc_build_real_type): Update comments re supported 128-bit floating-point types.
Diffstat (limited to 'gcc/fortran/iso-c-binding.def')
-rw-r--r--gcc/fortran/iso-c-binding.def15
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/fortran/iso-c-binding.def b/gcc/fortran/iso-c-binding.def
index 8bf69ef..e65c750 100644
--- a/gcc/fortran/iso-c-binding.def
+++ b/gcc/fortran/iso-c-binding.def
@@ -114,9 +114,14 @@ NAMED_REALCST (ISOCBINDING_DOUBLE, "c_double", \
get_real_kind_from_node (double_type_node), GFC_STD_F2003)
NAMED_REALCST (ISOCBINDING_LONG_DOUBLE, "c_long_double", \
get_real_kind_from_node (long_double_type_node), GFC_STD_F2003)
+
+/* GNU Extension. Note that the equivalence here is specifically to
+ the IEEE 128-bit type __float128; if that does not map onto a type
+ otherwise supported by the Fortran front end, get_real_kind_from_node
+ will reject it as unsupported. */
NAMED_REALCST (ISOCBINDING_FLOAT128, "c_float128", \
- gfc_float128_type_node == NULL_TREE \
- ? -4 : get_real_kind_from_node (gfc_float128_type_node), \
+ (float128_type_node == NULL_TREE \
+ ? -4 : get_real_kind_from_node (float128_type_node)), \
GFC_STD_GNU)
NAMED_CMPXCST (ISOCBINDING_FLOAT_COMPLEX, "c_float_complex", \
get_real_kind_from_node (float_type_node), GFC_STD_F2003)
@@ -124,9 +129,11 @@ NAMED_CMPXCST (ISOCBINDING_DOUBLE_COMPLEX, "c_double_complex", \
get_real_kind_from_node (double_type_node), GFC_STD_F2003)
NAMED_CMPXCST (ISOCBINDING_LONG_DOUBLE_COMPLEX, "c_long_double_complex", \
get_real_kind_from_node (long_double_type_node), GFC_STD_F2003)
+
+/* GNU Extension. Similar issues to c_float128 above. */
NAMED_CMPXCST (ISOCBINDING_FLOAT128_COMPLEX, "c_float128_complex", \
- gfc_float128_type_node == NULL_TREE \
- ? -4 : get_real_kind_from_node (gfc_float128_type_node), \
+ (float128_type_node == NULL_TREE \
+ ? -4 : get_real_kind_from_node (float128_type_node)), \
GFC_STD_GNU)
NAMED_LOGCST (ISOCBINDING_BOOL, "c_bool", \