aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-const.c
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>2010-09-11 16:34:20 +0000
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2010-09-11 16:34:20 +0000
commita67189d4904ebdae45829558f5ddd6f628e5c910 (patch)
tree615287f513f3d8f71931077bb3135b6eaeffadc3 /gcc/fortran/trans-const.c
parent616f12900dccc06a528586f8c7f969012d1e50a1 (diff)
downloadgcc-a67189d4904ebdae45829558f5ddd6f628e5c910.zip
gcc-a67189d4904ebdae45829558f5ddd6f628e5c910.tar.gz
gcc-a67189d4904ebdae45829558f5ddd6f628e5c910.tar.bz2
mathbuiltins.def: Do not defined huge_val built-in.
* mathbuiltins.def: Do not defined huge_val built-in. * trans-const.c (gfc_build_inf_or_huge): New function. * trans-const.h (gfc_build_inf_or_huge): New prototype. * f95-lang.c (gfc_init_builtin_functions): Don't defined huge_val built-ins. * trans-intrinsic.c (gfc_build_intrinsic_lib_fndecls): We don't have functions of type (*) (void) anymore. (gfc_conv_intrinsic_minmaxloc): Call gfc_build_inf_or_huge. (gfc_conv_intrinsic_nearest): Call gfc_build_inf_or_huge instead of generating a call to huge_val(). From-SVN: r164216
Diffstat (limited to 'gcc/fortran/trans-const.c')
-rw-r--r--gcc/fortran/trans-const.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/fortran/trans-const.c b/gcc/fortran/trans-const.c
index 51bc020..3d8d4ef 100644
--- a/gcc/fortran/trans-const.c
+++ b/gcc/fortran/trans-const.c
@@ -235,6 +235,26 @@ gfc_conv_mpfr_to_tree (mpfr_t f, int kind, int is_snan)
return build_real (type, real);
}
+/* Returns a real constant that is +Infinity if the target
+ supports infinities for this floating-point mode, and
+ +HUGE_VAL otherwise (the largest representable number). */
+
+tree
+gfc_build_inf_or_huge (tree type, int kind)
+{
+ if (HONOR_INFINITIES (TYPE_MODE (type)))
+ {
+ REAL_VALUE_TYPE real;
+ real_inf (&real);
+ return build_real (type, real);
+ }
+ else
+ {
+ int k = gfc_validate_kind (BT_REAL, kind, false);
+ return gfc_conv_mpfr_to_tree (gfc_real_kinds[k].huge, kind, 0);
+ }
+}
+
/* Converts a backend tree into a real constant. */
void