diff options
author | fxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-08-04 07:27:19 +0000 |
---|---|---|
committer | fxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-08-04 07:27:19 +0000 |
commit | c53bd1d9c1745c0e68de604ab46a29c382796751 (patch) | |
tree | 54d33530ee51771415c90c43ce2de54eb7cc9fef /gcc/fortran | |
parent | 207b8288310903e584235dd61bea2ff9b17a3548 (diff) | |
download | gcc-c53bd1d9c1745c0e68de604ab46a29c382796751.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226548 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/simplify.c | 79 |
2 files changed, 12 insertions, 73 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 36cd6f3b4cd..46f9a927938 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2015-08-04 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + PR fortran/64022 + * simplify.c (gfc_simplify_ieee_selected_real_kind): Extend IEEE + support to all real kinds. + 2015-08-03 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/66942 diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index 3fb98873709..f0fdfbdfa0d 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); } |