diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2007-08-13 06:16:03 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2007-08-13 06:16:03 +0000 |
commit | 1229ece065d2312eab6f29e6a012fbb5c6ad6eae (patch) | |
tree | 6cda691140c2048799e6ece3e64d23a216db0834 /gcc/fortran/trans-array.c | |
parent | d9acb717f1469f8fdee0a134cb046b22f5cacd10 (diff) | |
download | gcc-1229ece065d2312eab6f29e6a012fbb5c6ad6eae.zip gcc-1229ece065d2312eab6f29e6a012fbb5c6ad6eae.tar.gz gcc-1229ece065d2312eab6f29e6a012fbb5c6ad6eae.tar.bz2 |
re PR fortran/32962 (b = conjg(transpose(a)) is erroneous if b is an allocatable array)
2007-08-13 Paul Thomas <pault@gcc.gnu.org>
PR fortran/32962
* trans-array.c (gfc_conv_array_transpose): Set the offset
of the destination to zero if the loop is zero based.
2007-08-13 Paul Thomas <pault@gcc.gnu.org>
PR fortran/32962
* gfortran.dg/transpose_1.f90: New test.
From-SVN: r127391
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r-- | gcc/fortran/trans-array.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 1cf00fd..31d177b 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -783,13 +783,18 @@ gfc_conv_array_transpose (gfc_se * se, gfc_expr * expr) dest_info->data = gfc_conv_descriptor_data_get (src); gfc_conv_descriptor_data_set (&se->pre, dest, dest_info->data); - /* Copy the offset. This is not changed by transposition: the top-left - element is still at the same offset as before. */ - dest_info->offset = gfc_conv_descriptor_offset (src); + /* Copy the offset. This is not changed by transposition; the top-left + element is still at the same offset as before, except where the loop + starts at zero. */ + if (!integer_zerop (loop->from[0])) + dest_info->offset = gfc_conv_descriptor_offset (src); + else + dest_info->offset = gfc_index_zero_node; + gfc_add_modify_expr (&se->pre, gfc_conv_descriptor_offset (dest), dest_info->offset); - + if (dest_info->dimen > loop->temp_dim) loop->temp_dim = dest_info->dimen; } |