diff options
author | Richard Sandiford <richard@codesourcery.com> | 2005-09-13 08:07:15 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2005-09-13 08:07:15 +0000 |
commit | 4fd9a81345882be70ae24604eb98d3db9ec9f321 (patch) | |
tree | 4ffb56101370a9ad4a80a7d08f8ff17f9bffa6b7 /gcc/fortran/trans-array.c | |
parent | d7f0e25cd0e994e9f95e7709e0d6c6df587463a6 (diff) | |
download | gcc-4fd9a81345882be70ae24604eb98d3db9ec9f321.zip gcc-4fd9a81345882be70ae24604eb98d3db9ec9f321.tar.gz gcc-4fd9a81345882be70ae24604eb98d3db9ec9f321.tar.bz2 |
re PR fortran/18899 ([gfortran] ubound wrongly calculated for passed array)
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.
From-SVN: r104219
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r-- | gcc/fortran/trans-array.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index a7a1c55..a72a19d 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); |