]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/57697 ([OOP] Segfault with defined assignment for components during...
authorTobias Burnus <burnus@net-b.de>
Wed, 18 Sep 2013 22:19:03 +0000 (00:19 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Wed, 18 Sep 2013 22:19:03 +0000 (00:19 +0200)
2013-09-18  Tobias Burnus  <burnus@net-b.de>

        PR fortran/57697
        * gfortran.dg/defined_assignment_11.f90: New.

From-SVN: r202725

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/defined_assignment_11.f90 [new file with mode: 0644]

index 4ed1d8b943b86bd611e4a257857cf336a6bac1ed..8b6304f0ef2b66ea3d6151d60c542d0930f15f84 100644 (file)
@@ -1,3 +1,8 @@
+2013-09-18  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/57697
+       * gfortran.dg/defined_assignment_11.f90: New.
+
 2013-09-18  Vladimir Makarov  <vmakarov@redhat.com>
 
        PR rtl-optimization/58438
diff --git a/gcc/testsuite/gfortran.dg/defined_assignment_11.f90 b/gcc/testsuite/gfortran.dg/defined_assignment_11.f90
new file mode 100644 (file)
index 0000000..ec297d5
--- /dev/null
@@ -0,0 +1,43 @@
+! { dg-do run }
+!
+! PR fortran/57697
+!
+! Further test of typebound defined assignment
+!
+module m0
+  implicit none
+  type :: component
+    integer :: i = 42
+    integer, allocatable :: b
+  contains
+    procedure :: assign0
+    generic :: assignment(=) => assign0
+  end type
+  type, extends(component) :: comp2
+    real :: aa
+  end type comp2
+  type parent
+    type(component) :: foo
+    real :: cc
+  end type
+  type p2
+    type(parent) :: x
+  end type p2
+contains
+  elemental subroutine assign0(lhs,rhs)
+    class(component), intent(INout) :: lhs
+    class(component), intent(in) :: rhs
+    lhs%i = 20
+  end subroutine
+end module
+
+program main
+  use m0
+  implicit none
+  type(p2), allocatable :: left
+  type(p2) :: right
+!  print *, right%x%foo%i
+  left = right
+!  print *, left%x%foo%i
+  if (left%x%foo%i /= 20) call abort()
+end