diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2007-07-17 17:22:44 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2007-07-17 17:22:44 +0000 |
commit | 28114dadadfeedf9de14b51e8e2a5e5859d619e3 (patch) | |
tree | 68ba4b18261ead6f352d9cbbba151c1b0052fd4e /gcc/testsuite | |
parent | 4c85af60e8b5736e5534fee89d1a671b9f3ab7a9 (diff) | |
download | gcc-28114dadadfeedf9de14b51e8e2a5e5859d619e3.zip gcc-28114dadadfeedf9de14b51e8e2a5e5859d619e3.tar.gz gcc-28114dadadfeedf9de14b51e8e2a5e5859d619e3.tar.bz2 |
re PR fortran/31320 (Illegal read with gfortran.dg/alloc_comp_assign_2.f90 and *_3.f90)
2007-07-17 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31320
PR fortran/32665
* trans-expr.c (gfc_trans_subcomponent_assign): Ensure that
renormalization unity base is done independently of existing
lbound value.
(gfc_trans_scalar_assign): If rhs is not a variable, put
lse->pre after rse->pre to ensure that de-allocation of lhs
occurs after evaluation of rhs.
2007-07-17 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31320
PR fortran/32665
* gfortran.dg/alloc_comp_constructor_3.f90: New test.
From-SVN: r126703
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/alloc_comp_constructor_3.f90 | 16 |
2 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cb17867..ec808de 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2007-07-17 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/31320 + PR fortran/32665 + * gfortran.dg/alloc_comp_constructor_3.f90: New test. + 2007-07-17 Zdenek Dvorak <dvorakz@suse.cz> PR rtl-optimization/32773 diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_constructor_3.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_constructor_3.f90 new file mode 100644 index 0000000..53fa79c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/alloc_comp_constructor_3.f90 @@ -0,0 +1,16 @@ +! { dg-do run } +! Tests the fix for PR32665 in which the structure initializer at line +! 13 was getting the array length wrong by one and in which the automatic +! deallocation of a in 14 was occurring before the evaluation of the rhs. +! +! Contributed by Daniel Franke <dfranke@gcc.gnu.org> +! + TYPE :: x + INTEGER, ALLOCATABLE :: a(:) + END TYPE + TYPE(x) :: a + + a = x ((/ 1, 2, 3 /)) ! This is also pr31320. + a = x ((/ a%a, 4 /)) + if (any (a%a .ne. (/1,2,3,4/))) call abort () +end |