diff options
author | kargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-04-17 21:05:53 +0000 |
---|---|---|
committer | kargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-04-17 21:05:53 +0000 |
commit | f10ca8ea5d9cb6a4dad0b1c64806be1baf3a5c5f (patch) | |
tree | 845fbf8203fda73412490384debb7ae85d57924a /gcc/fortran/trans-array.c | |
parent | 205a2b6815e1c83fa82463b8419a743dfab454f6 (diff) | |
download | gcc-f10ca8ea5d9cb6a4dad0b1c64806be1baf3a5c5f.tar.gz |
2010-04-17 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/31538
* gfortran.dg/bounds_check_fail_4.f90: Adjust error message.
* gfortran.dg/bounds_check_fail_3.f90: Ditto.
2010-04-17 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/31538
* fortran/trans-array.c (gfc_conv_ss_startstride): Remove the use of
gfc_msg_bounds by using 'Array bound mismatch' directly.
(gfc_trans_dummy_array_bias): Remove the use of gfc_msg_bounds. Reword
error message to include the mismatch in the extent of array bound.
* fortran/trans.c: Remove gfc_msg_bounds. It is only used in one place.
* fortran/trans.h: Remove extern definition of gfc_msg_bounds.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158474 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r-- | gcc/fortran/trans-array.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index a880f0efe61..b03cc9400c9 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -3365,13 +3365,15 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop) if (size[n]) { tmp3 = fold_build2 (NE_EXPR, boolean_type_node, tmp, size[n]); - asprintf (&msg, "%s, size mismatch for dimension %d " - "of array '%s' (%%ld/%%ld)", gfc_msg_bounds, + asprintf (&msg, "Array bound mismatch for dimension %d " + "of array '%s' (%%ld/%%ld)", info->dim[n]+1, ss->expr->symtree->name); + gfc_trans_runtime_check (true, false, tmp3, &inner, &ss->expr->where, msg, fold_convert (long_integer_type_node, tmp), fold_convert (long_integer_type_node, size[n])); + gfc_free (msg); } else @@ -4632,15 +4634,26 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) { /* Check (ubound(a) - lbound(a) == ubound(b) - lbound(b)). */ char * msg; + tree temp; - tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type, - ubound, lbound); - stride2 = fold_build2 (MINUS_EXPR, gfc_array_index_type, + temp = fold_build2 (MINUS_EXPR, gfc_array_index_type, + ubound, lbound); + temp = fold_build2 (PLUS_EXPR, gfc_array_index_type, + gfc_index_one_node, temp); + + stride2 = fold_build2 (MINUS_EXPR, gfc_array_index_type, dubound, dlbound); - tmp = fold_build2 (NE_EXPR, gfc_array_index_type, tmp, stride2); - asprintf (&msg, "%s for dimension %d of array '%s'", - gfc_msg_bounds, n+1, sym->name); - gfc_trans_runtime_check (true, false, tmp, &block, &loc, msg); + stride2 = fold_build2 (PLUS_EXPR, gfc_array_index_type, + gfc_index_one_node, stride2); + + tmp = fold_build2 (NE_EXPR, gfc_array_index_type, temp, stride2); + asprintf (&msg, "Dimension %d of array '%s' has extent " + "%%ld instead of %%ld", n+1, sym->name); + + gfc_trans_runtime_check (true, false, tmp, &block, &loc, msg, + fold_convert (long_integer_type_node, temp), + fold_convert (long_integer_type_node, stride2)); + gfc_free (msg); } } |