diff options
Diffstat (limited to 'gcc/fortran/trans-intrinsic.cc')
-rw-r--r-- | gcc/fortran/trans-intrinsic.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/fortran/trans-intrinsic.cc b/gcc/fortran/trans-intrinsic.cc index 5505a21..e065e31 100644 --- a/gcc/fortran/trans-intrinsic.cc +++ b/gcc/fortran/trans-intrinsic.cc @@ -6443,6 +6443,15 @@ gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_expr * expr, enum tree_code op) tmp = gfc_conv_mpz_to_tree (gfc_integer_kinds[n].huge, expr->ts.kind); break; + case BT_UNSIGNED: + /* For MAXVAL, the minimum is zero, for MINVAL it is HUGE(). */ + if (op == GT_EXPR) + tmp = build_int_cst (type, 0); + else + tmp = gfc_conv_mpz_unsigned_to_tree (gfc_unsigned_kinds[n].huge, + expr->ts.kind); + break; + default: gcc_unreachable (); } @@ -6450,8 +6459,9 @@ gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_expr * expr, enum tree_code op) /* We start with the most negative possible value for MAXVAL, and the most positive possible value for MINVAL. The most negative possible value is -HUGE for BT_REAL and (-HUGE - 1) for BT_INTEGER; the most positive - possible value is HUGE in both cases. */ - if (op == GT_EXPR) + possible value is HUGE in both cases. BT_UNSIGNED has already been dealt + with above. */ + if (op == GT_EXPR && expr->ts.type != BT_UNSIGNED) { tmp = fold_build1_loc (input_location, NEGATE_EXPR, TREE_TYPE (tmp), tmp); if (huge_cst) |