summaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-array.c
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2007-10-14 20:24:20 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2007-10-14 20:24:20 +0000
commit366f17edd85893ad1057933b226660f95f18a878 (patch)
tree672198e6c129385eba3404a760dce3a50fe15747 /gcc/fortran/trans-array.c
parentdaf4a08b4c4b04fe0140d543de09e92ee0b61a57 (diff)
downloadgcc-366f17edd85893ad1057933b226660f95f18a878.tar.gz
2007-10-14 Tobias Burnus <burnus@net-b.de>
PR fortran/33745 * trans-array.c (gfc_conv_ss_startstride): Fix dimension check. (gfc_trans_array_bound_check, gfc_conv_array_ref, gfc_conv_ss_startstride): Simplify error message. * resolve.c (check_dimension): Fix dimension-type switch; improve error message. 2007-10-14 Tobias Burnus <burnus@net-b.de> PR fortran/33745 * gfortran.dg/bounds_check_11.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129302 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r--gcc/fortran/trans-array.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 4fb1fdaab53..c598d25ac1e 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -2109,11 +2109,11 @@ gfc_trans_array_bound_check (gfc_se * se, tree descriptor, tree index, int n,
tmp = gfc_conv_array_lbound (descriptor, n);
fault = fold_build2 (LT_EXPR, boolean_type_node, index, tmp);
if (name)
- asprintf (&msg, "%s for array '%s', lower bound of dimension %d exceeded",
- gfc_msg_fault, name, n+1);
+ asprintf (&msg, "%s for array '%s', lower bound of dimension %d exceeded"
+ "(%%ld < %%ld)", gfc_msg_fault, name, n+1);
else
- asprintf (&msg, "%s, lower bound of dimension %d exceeded, %%ld is "
- "smaller than %%ld", gfc_msg_fault, n+1);
+ asprintf (&msg, "%s, lower bound of dimension %d exceeded (%%ld < %%ld)",
+ gfc_msg_fault, n+1);
gfc_trans_runtime_check (fault, &se->pre, where, msg,
fold_convert (long_integer_type_node, index),
fold_convert (long_integer_type_node, tmp));
@@ -2126,10 +2126,10 @@ gfc_trans_array_bound_check (gfc_se * se, tree descriptor, tree index, int n,
fault = fold_build2 (GT_EXPR, boolean_type_node, index, tmp);
if (name)
asprintf (&msg, "%s for array '%s', upper bound of dimension %d "
- " exceeded", gfc_msg_fault, name, n+1);
+ " exceeded (%%ld > %%ld)", gfc_msg_fault, name, n+1);
else
- asprintf (&msg, "%s, upper bound of dimension %d exceeded, %%ld is "
- "larger than %%ld", gfc_msg_fault, n+1);
+ asprintf (&msg, "%s, upper bound of dimension %d exceeded (%%ld > %%ld)",
+ gfc_msg_fault, n+1);
gfc_trans_runtime_check (fault, &se->pre, where, msg,
fold_convert (long_integer_type_node, index),
fold_convert (long_integer_type_node, tmp));
@@ -2323,8 +2323,8 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_symbol * sym,
cond = fold_build2 (LT_EXPR, boolean_type_node,
indexse.expr, tmp);
asprintf (&msg, "%s for array '%s', "
- "lower bound of dimension %d exceeded, %%ld is smaller "
- "than %%ld", gfc_msg_fault, sym->name, n+1);
+ "lower bound of dimension %d exceeded (%%ld < %%ld)",
+ gfc_msg_fault, sym->name, n+1);
gfc_trans_runtime_check (cond, &se->pre, where, msg,
fold_convert (long_integer_type_node,
indexse.expr),
@@ -2340,8 +2340,8 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_symbol * sym,
cond = fold_build2 (GT_EXPR, boolean_type_node,
indexse.expr, tmp);
asprintf (&msg, "%s for array '%s', "
- "upper bound of dimension %d exceeded, %%ld is "
- "greater than %%ld", gfc_msg_fault, sym->name, n+1);
+ "upper bound of dimension %d exceeded (%%ld > %%ld)",
+ gfc_msg_fault, sym->name, n+1);
gfc_trans_runtime_check (cond, &se->pre, where, msg,
fold_convert (long_integer_type_node,
indexse.expr),
@@ -2888,7 +2888,7 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
if (info->ref->u.ar.dimen_type[dim] != DIMEN_RANGE)
continue;
- if (n == info->ref->u.ar.dimen - 1
+ if (dim == info->ref->u.ar.dimen - 1
&& (info->ref->u.ar.as->type == AS_ASSUMED_SIZE
|| info->ref->u.ar.as->cp_was_assumed))
check_upper = false;
@@ -2941,7 +2941,7 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
tmp = fold_build2 (TRUTH_AND_EXPR, boolean_type_node,
non_zerosized, tmp);
asprintf (&msg, "%s, lower bound of dimension %d of array '%s'"
- " exceeded, %%ld is smaller than %%ld", gfc_msg_fault,
+ " exceeded (%%ld < %%ld)", gfc_msg_fault,
info->dim[n]+1, ss->expr->symtree->name);
gfc_trans_runtime_check (tmp, &block, &ss->expr->where, msg,
fold_convert (long_integer_type_node,
@@ -2957,9 +2957,8 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
tmp = fold_build2 (TRUTH_AND_EXPR, boolean_type_node,
non_zerosized, tmp);
asprintf (&msg, "%s, upper bound of dimension %d of array "
- "'%s' exceeded, %%ld is greater than %%ld",
- gfc_msg_fault, info->dim[n]+1,
- ss->expr->symtree->name);
+ "'%s' exceeded (%%ld > %%ld)", gfc_msg_fault,
+ info->dim[n]+1, ss->expr->symtree->name);
gfc_trans_runtime_check (tmp, &block, &ss->expr->where, msg,
fold_convert (long_integer_type_node, info->start[n]),
fold_convert (long_integer_type_node, ubound));
@@ -2980,7 +2979,7 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
tmp = fold_build2 (TRUTH_AND_EXPR, boolean_type_node,
non_zerosized, tmp);
asprintf (&msg, "%s, lower bound of dimension %d of array '%s'"
- " exceeded, %%ld is smaller than %%ld", gfc_msg_fault,
+ " exceeded (%%ld < %%ld)", gfc_msg_fault,
info->dim[n]+1, ss->expr->symtree->name);
gfc_trans_runtime_check (tmp, &block, &ss->expr->where, msg,
fold_convert (long_integer_type_node,
@@ -2995,9 +2994,8 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
tmp = fold_build2 (TRUTH_AND_EXPR, boolean_type_node,
non_zerosized, tmp);
asprintf (&msg, "%s, upper bound of dimension %d of array "
- "'%s' exceeded, %%ld is greater than %%ld",
- gfc_msg_fault, info->dim[n]+1,
- ss->expr->symtree->name);
+ "'%s' exceeded (%%ld > %%ld)", gfc_msg_fault,
+ info->dim[n]+1, ss->expr->symtree->name);
gfc_trans_runtime_check (tmp, &block, &ss->expr->where, msg,
fold_convert (long_integer_type_node, tmp2),
fold_convert (long_integer_type_node, ubound));