summaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-const.c
diff options
context:
space:
mode:
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-11 16:34:20 +0000
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-11 16:34:20 +0000
commit729e6db2a99db15d9918b49ec10f32472957c83f (patch)
tree615287f513f3d8f71931077bb3135b6eaeffadc3 /gcc/fortran/trans-const.c
parent0ed2724e7288ffd5f86615389965c5b233069448 (diff)
downloadgcc-729e6db2a99db15d9918b49ec10f32472957c83f.tar.gz
* 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(). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164216 138bc75d-0d04-0410-961f-82ee72b054a4
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 51bc0201118..3d8d4ef8e7d 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