diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2019-02-09 11:11:33 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2019-02-09 11:11:33 +0000 |
commit | af3da717d627fbd4b6658ea72d443bd0f29f08ee (patch) | |
tree | 4ff484a0d027d11806d4d9c352ea111013ab7eb4 /gcc/fortran/trans-array.c | |
parent | de3ed9259f3b3cda69d44332b194c1c29666c719 (diff) | |
download | gcc-af3da717d627fbd4b6658ea72d443bd0f29f08ee.zip gcc-af3da717d627fbd4b6658ea72d443bd0f29f08ee.tar.gz gcc-af3da717d627fbd4b6658ea72d443bd0f29f08ee.tar.bz2 |
re PR fortran/89200 (Erroneous copying of a derived type with a deferred-length character array component)
2019-02-09 Paul Thomas <pault@gcc.gnu.org>
PR fortran/89200
* trans-array.c (gfc_trans_create_temp_array): Set the 'span'
field for derived types.
2019-02-09 Paul Thomas <pault@gcc.gnu.org>
PR fortran/89200
* gfortran.dg/array_reference_2.f90 : New test.
From-SVN: r268721
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r-- | gcc/fortran/trans-array.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 2527950..f15d3a3 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -1293,6 +1293,15 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, gfc_ss * ss, tmp = gfc_conv_descriptor_dtype (desc); gfc_add_modify (pre, tmp, gfc_get_dtype (TREE_TYPE (desc))); + /* Also set the span for derived types, since they can be used in + component references to arrays of this type. */ + if (TREE_CODE (eltype) == RECORD_TYPE) + { + tmp = TYPE_SIZE_UNIT (eltype); + tmp = fold_convert (gfc_array_index_type, tmp); + gfc_conv_descriptor_span_set (pre, desc, tmp); + } + /* Fill in the bounds and stride. This is a packed array, so: |