diff options
author | pault <pault@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-06 05:25:46 +0000 |
---|---|---|
committer | pault <pault@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-06 05:25:46 +0000 |
commit | d6fd607debfd500aac131f2efda95fda8f1178f6 (patch) | |
tree | 5c4149762b06b86b82f6a93c8de2a1ff3013eb9c /gcc/fortran/trans-array.c | |
parent | 0b0d47a1aaa1393bb8ea8501f23cd07d9fb8bec7 (diff) | |
download | gcc-d6fd607debfd500aac131f2efda95fda8f1178f6.tar.gz |
2009-04-06 Paul Thomas <pault@gcc.gnu.org>
PR fortran/36091
* trans-array.c (gfc_conv_array_ref): If the symbol has the
temporary attribute use the array_spec for the bounds.
* gfortran.h : Add the temporary field to the structure
'symbol_attribute'.
* trans-stmt.c (forall_make_variable_temp): Set the symbol's
temporary attribute.
2009-04-06 Paul Thomas <pault@gcc.gnu.org
PR fortran/36091
* gfortran.dg/forall_13.f90: Add -fbounds-check option.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145581 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r-- | gcc/fortran/trans-array.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index bc045dbd356..151f2cab40d 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -2452,6 +2452,7 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_symbol * sym, tree tmp; tree stride; gfc_se indexse; + gfc_se tmpse; /* Handle scalarized references separately. */ if (ar->type != AR_ELEMENT) @@ -2482,6 +2483,15 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_symbol * sym, /* Lower bound. */ tmp = gfc_conv_array_lbound (se->expr, n); + if (sym->attr.temporary) + { + gfc_init_se (&tmpse, se); + gfc_conv_expr_type (&tmpse, ar->as->lower[n], + gfc_array_index_type); + gfc_add_block_to_block (&se->pre, &tmpse.pre); + tmp = tmpse.expr; + } + cond = fold_build2 (LT_EXPR, boolean_type_node, indexse.expr, tmp); asprintf (&msg, "%s for array '%s', " @@ -2499,6 +2509,15 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_symbol * sym, || (ar->as->type != AS_ASSUMED_SIZE && !ar->as->cp_was_assumed)) { tmp = gfc_conv_array_ubound (se->expr, n); + if (sym->attr.temporary) + { + gfc_init_se (&tmpse, se); + gfc_conv_expr_type (&tmpse, ar->as->upper[n], + gfc_array_index_type); + gfc_add_block_to_block (&se->pre, &tmpse.pre); + tmp = tmpse.expr; + } + cond = fold_build2 (GT_EXPR, boolean_type_node, indexse.expr, tmp); asprintf (&msg, "%s for array '%s', " |