===================================================================
@@ -3729,9 +3729,9 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * s
possible value is HUGE in both cases. */
if (op == GT_EXPR)
tmp = fold_build1_loc (input_location, NEGATE_EXPR, TREE_TYPE (tmp), tmp);
- if (op == GT_EXPR && expr->ts.type == BT_INTEGER)
+ if (op == GT_EXPR && arrayexpr->ts.type == BT_INTEGER)
tmp = fold_build2_loc (input_location, MINUS_EXPR, TREE_TYPE (tmp), tmp,
- build_int_cst (type, 1));
+ build_int_cst (TREE_TYPE (tmp), 1));
gfc_add_modify (&se->pre, limit, tmp);