re PR fortran/59781 ([F03] Incorrect initialisation of derived type)
authorThomas Koenig <tkoenig@gcc.gnu.org>
Thu, 22 Feb 2018 22:01:53 +0000 (22:01 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Thu, 22 Feb 2018 22:01:53 +0000 (22:01 +0000)
2018-02-22  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/59781
* gfortran.dg/derived_init_5.f90: New test.

From-SVN: r257917

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

index 368b9809371f4954762e7b286c4b04e86a93db36..62b65bf8e1c3ead8095ed552cb7e135d1d517813 100644 (file)
@@ -1,3 +1,8 @@
+2018-02-22  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/59781
+       * gfortran.dg/derived_init_5.f90: New test.
+
 2018-02-22  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/82851
diff --git a/gcc/testsuite/gfortran.dg/derived_init_5.f90 b/gcc/testsuite/gfortran.dg/derived_init_5.f90
new file mode 100644 (file)
index 0000000..b94ca39
--- /dev/null
@@ -0,0 +1,24 @@
+! { dg-do  run }
+! PR 59781 - this was not initialized correctly before.
+! Original test case by James Spencer.
+  implicit none
+  
+  type t1
+    integer :: s
+  end type
+  
+  type t2
+    type(t1) :: state = t1(1)
+    real, allocatable :: store(:)
+  end type
+  
+  call test
+
+contains
+
+  subroutine test
+    type(t2) :: rng
+    if (rng%state%s /= 1) STOP 1
+  end subroutine
+
+end