Do not assume that __float128 exists
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 10 Mar 2021 11:05:53 +0000 (12:05 +0100)
committerEric Botcazou <ebotcazou@adacore.com>
Wed, 10 Mar 2021 11:32:03 +0000 (12:32 +0100)
The code in build_round_expr implicitly assumes that __float128 exists,
which is *not* the common case among 64-bit architectures since the
"long double" type is generally already 128-bit for them.

gcc/fortran/
PR fortran/96983
* trans-intrinsic.c (build_round_expr): Do not implicitly assume
that __float128 is the 128-bit floating-point type.

gcc/fortran/trans-intrinsic.c

index 5c9258c..9cf3642 100644 (file)
@@ -407,7 +407,7 @@ build_round_expr (tree arg, tree restype)
       if (kind < 0)
        gfc_internal_error ("Could not find real kind with at least %d bits",
                            resprec);
-      arg = fold_convert (gfc_float128_type_node, arg);
+      arg = fold_convert (gfc_get_real_type (kind), arg);
       fn = gfc_builtin_decl_for_float_kind (BUILT_IN_ROUND, kind);
     }
   else