summaryrefslogtreecommitdiffstats
path: root/gcc/fortran/trans-array.c
diff options
context:
space:
mode:
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2006-05-29 19:21:27 +0000
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2006-05-29 19:21:27 +0000
commit81ad3bc785c8a6366481340a21b5305e0bad6939 (patch)
tree72679f07b58b86bfa69a3e753279e179052931f9 /gcc/fortran/trans-array.c
parent918c1f3d05b1f1631ab98c48e48f6935c38117dc (diff)
downloadppe42-gcc-81ad3bc785c8a6366481340a21b5305e0bad6939.tar.gz
ppe42-gcc-81ad3bc785c8a6366481340a21b5305e0bad6939.zip
PR fortran/19777
* trans-array.c (gfc_conv_array_ref): Perform out-of-bounds checking for assumed-size arrrays for all but the last dimension. * gfortran.dg/bounds_check_2.f: Add new check for multidimensional arrays. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114210 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r--gcc/fortran/trans-array.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 737beeffc35..7dfba2afd6c 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -1783,7 +1783,7 @@ gfc_trans_array_bound_check (gfc_se * se, tree descriptor, tree index, int n)
cond = fold_build2 (GT_EXPR, boolean_type_node, index, tmp);
fault = fold_build2 (TRUTH_OR_EXPR, boolean_type_node, fault, cond);
- gfc_trans_runtime_check (fault, gfc_strconst_fault, &se->pre);
+ gfc_trans_runtime_check (fault, gfc_msg_fault, &se->pre);
return index;
}
@@ -1948,7 +1948,8 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar)
gfc_conv_expr_type (&indexse, ar->start[n], gfc_array_index_type);
gfc_add_block_to_block (&se->pre, &indexse.pre);
- if (flag_bounds_check && ar->as->type != AS_ASSUMED_SIZE)
+ if (flag_bounds_check &&
+ (ar->as->type != AS_ASSUMED_SIZE || n < ar->dimen - 1))
{
/* Check array bounds. */
tree cond;
@@ -1978,7 +1979,7 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar)
}
if (flag_bounds_check)
- gfc_trans_runtime_check (fault, gfc_strconst_fault, &se->pre);
+ gfc_trans_runtime_check (fault, gfc_msg_fault, &se->pre);
tmp = gfc_conv_array_offset (se->expr);
if (!integer_zerop (tmp))
@@ -2519,7 +2520,7 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
size[n] = gfc_evaluate_now (tmp, &block);
}
}
- gfc_trans_runtime_check (fault, gfc_strconst_bounds, &block);
+ gfc_trans_runtime_check (fault, gfc_msg_bounds, &block);
tmp = gfc_finish_block (&block);
gfc_add_expr_to_block (&loop->pre, tmp);
@@ -3714,7 +3715,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
stride2 = build2 (MINUS_EXPR, gfc_array_index_type,
dubound, dlbound);
tmp = fold_build2 (NE_EXPR, gfc_array_index_type, tmp, stride2);
- gfc_trans_runtime_check (tmp, gfc_strconst_bounds, &block);
+ gfc_trans_runtime_check (tmp, gfc_msg_bounds, &block);
}
}
else
OpenPOWER on IntegriCloud