]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Additional test cases for using automatic variables in equivalence statements.
authormarkeggleston <markeggleston@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 Oct 2019 10:39:49 +0000 (10:39 +0000)
committermarkeggleston <markeggleston@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 Oct 2019 10:39:49 +0000 (10:39 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@277097 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/auto_in_equiv_3.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/auto_in_equiv_4.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/auto_in_equiv_5.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/auto_in_equiv_6.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/auto_in_equiv_7.f90 [new file with mode: 0644]

index 65e80d5abb2703e70672c643e15b48c2c0e13dca..401149a16bd06a75c9f3a8d4f6beb4b5e4a5e03e 100644 (file)
@@ -1,3 +1,11 @@
+2019-10-17  Mark Eggleston <mark.eggleston@codethink.com>
+
+       * gfortran.dg/auto_in_equiv_3.f90: New test.
+       * gfortran.dg/auto_in_equiv_4.f90: New test.
+       * gfortran.dg/auto_in_equiv_5.f90: New test.
+       * gfortran.dg/auto_in_equiv_6.f90: New test.
+       * gfortran.dg/auto_in_equiv_7.f90: New test.
+
 2019-10-17  Georg-Johann Lay  <avr@gjlay.de>
 
        * gcc.target/avr/progmem-error-1.cpp: Fix location of the
diff --git a/gcc/testsuite/gfortran.dg/auto_in_equiv_3.f90 b/gcc/testsuite/gfortran.dg/auto_in_equiv_3.f90
new file mode 100644 (file)
index 0000000..35f6e0f
--- /dev/null
@@ -0,0 +1,19 @@
+! { dg-do compile }
+! { dg-options "-fdec-static -fdump-tree-original" }
+!
+
+subroutine foo
+  integer, automatic :: a
+  integer :: b
+  equivalence (a, b)
+  a = 5
+  if (b.ne.5) stop 1
+end subroutine
+
+! { dg-final { scan-tree-dump "union" "original" } }
+! { dg-final { scan-tree-dump-not "static union" "original" } }
+! { dg-final { scan-tree-dump "integer\\(kind=4\\) a" "original" } }
+! { dg-final { scan-tree-dump-not "static integer\\(kind=4\\) a" "original" } }
+! { dg-final { scan-tree-dump "integer\\(kind=4\\) b" "original" } }
+! { dg-final { scan-tree-dump-not "static integer\\(kind=4\\) b" "original" } }
+
diff --git a/gcc/testsuite/gfortran.dg/auto_in_equiv_4.f90 b/gcc/testsuite/gfortran.dg/auto_in_equiv_4.f90
new file mode 100644 (file)
index 0000000..3188f19
--- /dev/null
@@ -0,0 +1,18 @@
+! { dg-do compile }
+! { dg-options "-fdec-static -fno-automatic -fdump-tree-original" }
+!
+! Neither of the local variable have the automatic attribute so they
+! not be allocated on the stack.
+
+subroutine foo
+  integer :: a
+  integer :: b
+  equivalence (a, b)
+  a = 5
+  if (b.ne.5) stop 1
+end subroutine
+
+! { dg-final { scan-tree-dump "static union" "original" } }
+! { dg-final { scan-tree-dump "static integer\\(kind=4\\) a" "original" } }
+! { dg-final { scan-tree-dump "static integer\\(kind=4\\) b" "original" } }
+
diff --git a/gcc/testsuite/gfortran.dg/auto_in_equiv_5.f90 b/gcc/testsuite/gfortran.dg/auto_in_equiv_5.f90
new file mode 100644 (file)
index 0000000..d1e08a6
--- /dev/null
@@ -0,0 +1,18 @@
+! { dg-do compile }
+! { dg-options "-fdump-tree-original" }
+!
+! Neither of the local variable have the automatic attribute so they
+! not be allocated on the stack.
+
+subroutine foo
+  integer, save :: a
+  integer :: b
+  equivalence (a, b)
+  a = 5
+  if (b.ne.5) stop 1
+end subroutine
+
+! { dg-final { scan-tree-dump "static union" "original" } }
+! { dg-final { scan-tree-dump "static integer\\(kind=4\\) a" "original" } }
+! { dg-final { scan-tree-dump "static integer\\(kind=4\\) b" "original" } }
+
diff --git a/gcc/testsuite/gfortran.dg/auto_in_equiv_6.f90 b/gcc/testsuite/gfortran.dg/auto_in_equiv_6.f90
new file mode 100644 (file)
index 0000000..f413521
--- /dev/null
@@ -0,0 +1,18 @@
+! { dg-do compile }
+! { dg-options "-fdec-static -fdump-tree-original" }
+!
+! Neither of the local variable have the automatic attribute so they
+! not be allocated on the stack.
+
+subroutine foo
+  integer, static :: a
+  integer :: b
+  equivalence (a, b)
+  a = 5
+  if (b.ne.5) stop 1
+end subroutine
+
+! { dg-final { scan-tree-dump "static union" "original" } }
+! { dg-final { scan-tree-dump "static integer\\(kind=4\\) a" "original" } }
+! { dg-final { scan-tree-dump "static integer\\(kind=4\\) b" "original" } }
+
diff --git a/gcc/testsuite/gfortran.dg/auto_in_equiv_7.f90 b/gcc/testsuite/gfortran.dg/auto_in_equiv_7.f90
new file mode 100644 (file)
index 0000000..fd7e672
--- /dev/null
@@ -0,0 +1,19 @@
+! { dg-do compile }
+! { dg-options "-fdec-static -fdump-tree-original" }
+!
+
+subroutine foo
+  integer :: a
+  integer, automatic :: b
+  equivalence (a, b)
+  a = 5
+  if (b.ne.5) stop 1
+end subroutine
+
+! { dg-final { scan-tree-dump "union" "original" } }
+! { dg-final { scan-tree-dump-not "static union" "original" } }
+! { dg-final { scan-tree-dump "integer\\(kind=4\\) a" "original" } }
+! { dg-final { scan-tree-dump-not "static integer\\(kind=4\\) a" "original" } }
+! { dg-final { scan-tree-dump "integer\\(kind=4\\) b" "original" } }
+! { dg-final { scan-tree-dump-not "static integer\\(kind=4\\) b" "original" } }
+