From b1c02fdc550e83ba4dbb907cce1808fac2f0ecef Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Sun, 5 Feb 2012 10:46:20 +0100 Subject: [PATCH] re PR fortran/51972 ([OOP] Wrong code as _copy does not honor CLASS components) 2012-02-05 Tobias Burnus PR fortran/51972 * gfortran.dg/class_48.f90: Add some further checks. From-SVN: r183904 --- gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/gfortran.dg/class_48.f90 | 47 ++++++++++++++++++++++---- 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 93a7c0f1b58..92d7759fd02 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-02-05 Tobias Burnus + + PR fortran/51972 + * gfortran.dg/class_48.f90: Add some further checks. + 2012-02-05 Ira Rosen PR tree-optimization/52091 diff --git a/gcc/testsuite/gfortran.dg/class_48.f90 b/gcc/testsuite/gfortran.dg/class_48.f90 index c61a8e5ddb5..c1bab8ef0d5 100644 --- a/gcc/testsuite/gfortran.dg/class_48.f90 +++ b/gcc/testsuite/gfortran.dg/class_48.f90 @@ -70,13 +70,15 @@ subroutine test3 () type(t2) :: one, two - one = two + allocate (two%a(2)) + two%a(1)%x = 4 + two%a(2)%x = 6 if (allocated (one%a)) call abort () - - allocate (two%a(2), source=[t(4), t(6)]) one = two if (.not.allocated (one%a)) call abort () -! FIXME: Check value + + if ((one%a(1)%x /= 4)) call abort () + if ((one%a(2)%x /= 6)) call abort () deallocate (two%a) one = two @@ -94,12 +96,43 @@ subroutine test4 () type(t2) :: one, two - one = two if (allocated (one%a)) call abort () - -! allocate (two%a(2)) ! ICE: SEGFAULT + if (allocated (two%a)) call abort () +! +! FIXME: Fails due to PR 51754 +! +! NOTE: Might be only visible with MALLOC_PERTURB_ or with valgrind +! +! allocate (two%a(2)) +! if (allocated (two%a(1)%x)) call abort () +! if (allocated (two%a(2)%x)) call abort () +! allocate (two%a(1)%x(3), source=[1,2,3]) +! allocate (two%a(2)%x(5), source=[5,6,7,8,9]) ! one = two ! if (.not. allocated (one%a)) call abort () +! if (.not. allocated (one%a(1)%x)) call abort () +! if (.not. allocated (one%a(2)%x)) call abort () +! +! if (size(one%a) /= 2) call abort() +! if (size(one%a(1)%x) /= 3) call abort() +! if (size(one%a(2)%x) /= 5) call abort() +! if (any (one%a(1)%x /= [1,2,3])) call abort () +! if (any (one%a(2)%x /= [5,6,7,8,9])) call abort () +! +! deallocate (two%a(1)%x) +! one = two +! if (.not. allocated (one%a)) call abort () +! if (allocated (one%a(1)%x)) call abort () +! if (.not. allocated (one%a(2)%x)) call abort () +! +! if (size(one%a) /= 2) call abort() +! if (size(one%a(2)%x) /= 5) call abort() +! if (any (one%a(2)%x /= [5,6,7,8,9])) call abort () +! +! deallocate (two%a) + one = two + if (allocated (one%a)) call abort () + if (allocated (two%a)) call abort () end subroutine test4