aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/dec_structure_3.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/dec_structure_3.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/dec_structure_3.f9052
1 files changed, 52 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/dec_structure_3.f90 b/gcc/testsuite/gfortran.dg/dec_structure_3.f90
new file mode 100644
index 00000000000..9cb7adb6719
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/dec_structure_3.f90
@@ -0,0 +1,52 @@
+! { dg-do run }
+! { dg-options "-fdec-structure" }
+!
+! Test nested STRUCTURE definitions.
+!
+
+subroutine aborts (s)
+ character(*), intent(in) :: s
+ print *, s
+ call abort()
+end subroutine
+
+structure /s3/
+ real p
+ structure /s4/ recrd, recrd_a(3)
+ integer i, j
+ end structure
+ real q
+end structure
+
+record /s3/ r3
+record /s4/ r4
+
+r3.p = 1.3579
+r4.i = 0
+r4.j = 1
+r3.recrd = r4
+r3.recrd_a(1) = r3.recrd
+r3.recrd_a(2).i = 1
+r3.recrd_a(2).j = 0
+
+if (r3.p .ne. 1.3579) then
+ call aborts("r3.p")
+endif
+
+if (r4.i .ne. 0) then
+ call aborts("r4.i")
+endif
+
+if (r4.j .ne. 1) then
+ call aborts("r4.j")
+endif
+
+if (r3.recrd.i .ne. 0 .or. r3.recrd.j .ne. 1) then
+ call aborts("r3.recrd")
+endif
+
+if (r3.recrd_a(2).i .ne. 1 .or. r3.recrd_a(2).j .ne. 0) then
+ call aborts("r3.recrd_a(2)")
+endif
+
+end