aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/simplify.c
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>2015-08-04 07:27:19 +0000
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2015-08-04 07:27:19 +0000
commit22a499884f31391a6ab02739861b2b343eebc94e (patch)
tree54d33530ee51771415c90c43ce2de54eb7cc9fef /gcc/fortran/simplify.c
parent0ad23163d01cb104d39f9b21bad009812fb96042 (diff)
downloadgcc-22a499884f31391a6ab02739861b2b343eebc94e.zip
gcc-22a499884f31391a6ab02739861b2b343eebc94e.tar.gz
gcc-22a499884f31391a6ab02739861b2b343eebc94e.tar.bz2
re PR fortran/64022 ([F2003][IEEE] ieee_support_flag does not handle kind=10 and kind=16 REAL variables)
PR fortran/64022 * simplify.c (gfc_simplify_ieee_selected_real_kind): Extend IEEE support to all real kinds. * ieee/ieee_exceptions.F90: Support all real kinds. * ieee/ieee_arithmetic.F90: Likewise. * ieee/ieee_helper.c (ieee_class_helper_10, ieee_class_helper_16): New functions * gfortran.map (GFORTRAN_1.7): Add entries. * gfortran.dg/ieee/ieee_7.f90: Adjust test. * gfortran.dg/ieee/large_1.f90: New test. From-SVN: r226548
Diffstat (limited to 'gcc/fortran/simplify.c')
-rw-r--r--gcc/fortran/simplify.c79
1 files changed, 6 insertions, 73 deletions
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index 3fb9887..f0fdfbd 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -5556,80 +5556,13 @@ gfc_expr *
gfc_simplify_ieee_selected_real_kind (gfc_expr *expr)
{
gfc_actual_arglist *arg = expr->value.function.actual;
- gfc_expr *p = arg->expr, *r = arg->next->expr,
- *rad = arg->next->next->expr;
- int precision, range, radix, res;
- int found_precision, found_range, found_radix, i;
+ gfc_expr *p = arg->expr, *q = arg->next->expr,
+ *rdx = arg->next->next->expr;
- if (p)
- {
- if (p->expr_type != EXPR_CONSTANT
- || gfc_extract_int (p, &precision) != NULL)
- return NULL;
- }
- else
- precision = 0;
-
- if (r)
- {
- if (r->expr_type != EXPR_CONSTANT
- || gfc_extract_int (r, &range) != NULL)
- return NULL;
- }
- else
- range = 0;
-
- if (rad)
- {
- if (rad->expr_type != EXPR_CONSTANT
- || gfc_extract_int (rad, &radix) != NULL)
- return NULL;
- }
- else
- radix = 0;
-
- res = INT_MAX;
- found_precision = 0;
- found_range = 0;
- found_radix = 0;
-
- for (i = 0; gfc_real_kinds[i].kind != 0; i++)
- {
- /* We only support the target's float and double types. */
- if (!gfc_real_kinds[i].c_float && !gfc_real_kinds[i].c_double)
- continue;
-
- if (gfc_real_kinds[i].precision >= precision)
- found_precision = 1;
-
- if (gfc_real_kinds[i].range >= range)
- found_range = 1;
-
- if (radix == 0 || gfc_real_kinds[i].radix == radix)
- found_radix = 1;
-
- if (gfc_real_kinds[i].precision >= precision
- && gfc_real_kinds[i].range >= range
- && (radix == 0 || gfc_real_kinds[i].radix == radix)
- && gfc_real_kinds[i].kind < res)
- res = gfc_real_kinds[i].kind;
- }
-
- if (res == INT_MAX)
- {
- if (found_radix && found_range && !found_precision)
- res = -1;
- else if (found_radix && found_precision && !found_range)
- res = -2;
- else if (found_radix && !found_precision && !found_range)
- res = -3;
- else if (found_radix)
- res = -4;
- else
- res = -5;
- }
-
- return gfc_get_int_expr (gfc_default_integer_kind, &expr->where, res);
+ /* Currently, if IEEE is supported and this module is built, it means
+ all our floating-point types conform to IEEE. Hence, we simply handle
+ IEEE_SELECTED_REAL_KIND like SELECTED_REAL_KIND. */
+ return gfc_simplify_selected_real_kind (p, q, rdx);
}