+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
--- /dev/null
+! { 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" } }
+
--- /dev/null
+! { 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" } }
+
--- /dev/null
+! { 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" } }
+
--- /dev/null
+! { 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" } }
+
--- /dev/null
+! { 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" } }
+