aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2012-02-05 10:46:20 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2012-02-05 10:46:20 +0100
commitb1c02fdc550e83ba4dbb907cce1808fac2f0ecef (patch)
tree7090cefc27bd9ce3b4fe04581f1232ffd9d1000e
parent24ee13842edcacff46a4f06d3b469d0bdc6d0a73 (diff)
downloadgcc-b1c02fdc550e83ba4dbb907cce1808fac2f0ecef.zip
gcc-b1c02fdc550e83ba4dbb907cce1808fac2f0ecef.tar.gz
gcc-b1c02fdc550e83ba4dbb907cce1808fac2f0ecef.tar.bz2
re PR fortran/51972 ([OOP] Wrong code as _copy does not honor CLASS components)
2012-02-05 Tobias Burnus <burnus@net-b.de> PR fortran/51972 * gfortran.dg/class_48.f90: Add some further checks. From-SVN: r183904
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/class_48.f9047
2 files changed, 45 insertions, 7 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 93a7c0f..92d7759 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-02-05 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/51972
+ * gfortran.dg/class_48.f90: Add some further checks.
+
2012-02-05 Ira Rosen <irar@il.ibm.com>
PR tree-optimization/52091
diff --git a/gcc/testsuite/gfortran.dg/class_48.f90 b/gcc/testsuite/gfortran.dg/class_48.f90
index c61a8e5..c1bab8e 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