diff options
author | Janne Blomqvist <jb@gcc.gnu.org> | 2018-08-23 11:35:17 +0300 |
---|---|---|
committer | Janne Blomqvist <jb@gcc.gnu.org> | 2018-08-23 11:35:17 +0300 |
commit | 9c44db9f23e7f3ce713a7b78195fc91b002ead11 (patch) | |
tree | c93de882bbf966319823abe0489a97710c6f1c99 /gcc | |
parent | 0aa2934aaa0e22917cfb32a8478c3d973eff8969 (diff) | |
download | gcc-9c44db9f23e7f3ce713a7b78195fc91b002ead11.zip gcc-9c44db9f23e7f3ce713a7b78195fc91b002ead11.tar.gz gcc-9c44db9f23e7f3ce713a7b78195fc91b002ead11.tar.bz2 |
Signed zero for {max,min}val intrinsics
The Fortran standard specifies (e.g. F2018 7.4.3.2) that intrinsic
procedures shall treat positive and negative real zero as equivalent,
unless it is explicitly specified otherwise. For {max,min}val there
is no such explicit mention. Thus, remove code to handle signed
zeros.
2018-08-23 Janne Blomqvist <blomqvist.janne@gmail.com>
* trans-intrinsic.c (gfc_conv_intrinsic_minmaxval): Delete
HONOR_SIGNED_ZEROS checks.
From-SVN: r263802
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/trans-intrinsic.c | 26 |
2 files changed, 12 insertions, 21 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 4cbdc68..c58e12c 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,4 +1,9 @@ -2017-08-23 Paul Thomas <pault@gcc.gnu.org> +2018-08-23 Janne Blomqvist <blomqvist.janne@gmail.com> + + * trans-intrinsic.c (gfc_conv_intrinsic_minmaxval): Delete + HONOR_SIGNED_ZEROS checks. + +2018-08-23 Paul Thomas <pault@gcc.gnu.org> PR fortran/86863 * resolve.c (resolve_typebound_call): If the TBP is not marked diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 387cf80..b2cea93 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -5511,22 +5511,10 @@ gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_expr * expr, enum tree_code op) { /* MIN_EXPR/MAX_EXPR has unspecified behavior with NaNs or signed zeros. */ - if (HONOR_SIGNED_ZEROS (DECL_MODE (limit))) - { - tmp = fold_build2_loc (input_location, op, logical_type_node, - arrayse.expr, limit); - ifbody = build2_v (MODIFY_EXPR, limit, arrayse.expr); - tmp = build3_v (COND_EXPR, tmp, ifbody, - build_empty_stmt (input_location)); - gfc_add_expr_to_block (&block2, tmp); - } - else - { - tmp = fold_build2_loc (input_location, - op == GT_EXPR ? MAX_EXPR : MIN_EXPR, - type, arrayse.expr, limit); - gfc_add_modify (&block2, limit, tmp); - } + tmp = fold_build2_loc (input_location, + op == GT_EXPR ? MAX_EXPR : MIN_EXPR, + type, arrayse.expr, limit); + gfc_add_modify (&block2, limit, tmp); } if (fast) @@ -5535,8 +5523,7 @@ gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_expr * expr, enum tree_code op) /* MIN_EXPR/MAX_EXPR has unspecified behavior with NaNs or signed zeros. */ - if (HONOR_NANS (DECL_MODE (limit)) - || HONOR_SIGNED_ZEROS (DECL_MODE (limit))) + if (HONOR_NANS (DECL_MODE (limit))) { tmp = fold_build2_loc (input_location, op, logical_type_node, arrayse.expr, limit); @@ -5598,8 +5585,7 @@ gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_expr * expr, enum tree_code op) /* MIN_EXPR/MAX_EXPR has unspecified behavior with NaNs or signed zeros. */ - if (HONOR_NANS (DECL_MODE (limit)) - || HONOR_SIGNED_ZEROS (DECL_MODE (limit))) + if (HONOR_NANS (DECL_MODE (limit))) { tmp = fold_build2_loc (input_location, op, logical_type_node, arrayse.expr, limit); |