summaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-array.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-13 08:07:15 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-13 08:07:15 +0000
commitec9200dc186d96741a2e2f9fee6a8f291ce1e647 (patch)
tree4ffb56101370a9ad4a80a7d08f8ff17f9bffa6b7 /gcc/fortran/trans-array.c
parent4f62605b84a6f6be88c854271a718cd721377c2b (diff)
downloadgcc-ec9200dc186d96741a2e2f9fee6a8f291ce1e647.tar.gz
PR fortran/18899
* trans-intrinsic.c (gfc_conv_intrinsic_bound): Move initialization of argse. Remove now-redundant want_pointer assignment. * trans-array.c (gfc_conv_expr_descriptor): When not assigning to a pointer, keep the original bounds of a full array reference. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104219 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r--gcc/fortran/trans-array.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index a7a1c558d0e..a72a19dcdce 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -3981,9 +3981,13 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
/* Set the new lower bound. */
from = loop.from[dim];
to = loop.to[dim];
- if (!integer_onep (from))
+
+ /* If we have an array section or are assigning to a pointer,
+ make sure that the lower bound is 1. References to the full
+ array should otherwise keep the original bounds. */
+ if ((info->ref->u.ar.type != AR_FULL || se->direct_byref)
+ && !integer_onep (from))
{
- /* Make sure the new section starts at 1. */
tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type,
gfc_index_one_node, from);
to = fold_build2 (PLUS_EXPR, gfc_array_index_type, to, tmp);