From c95ee96bee5db83038e931750c0866608a59107c Mon Sep 17 00:00:00 2001 From: Mark Eggleston Date: Thu, 17 Oct 2019 10:39:49 +0000 Subject: [PATCH] Additional test cases for using automatic variables in equivalence statements. From-SVN: r277097 --- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gfortran.dg/auto_in_equiv_3.f90 | 19 +++++++++++++++++++ gcc/testsuite/gfortran.dg/auto_in_equiv_4.f90 | 18 ++++++++++++++++++ gcc/testsuite/gfortran.dg/auto_in_equiv_5.f90 | 18 ++++++++++++++++++ gcc/testsuite/gfortran.dg/auto_in_equiv_6.f90 | 18 ++++++++++++++++++ gcc/testsuite/gfortran.dg/auto_in_equiv_7.f90 | 19 +++++++++++++++++++ 6 files changed, 100 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/auto_in_equiv_3.f90 create mode 100644 gcc/testsuite/gfortran.dg/auto_in_equiv_4.f90 create mode 100644 gcc/testsuite/gfortran.dg/auto_in_equiv_5.f90 create mode 100644 gcc/testsuite/gfortran.dg/auto_in_equiv_6.f90 create mode 100644 gcc/testsuite/gfortran.dg/auto_in_equiv_7.f90 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 65e80d5abb2..401149a16bd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-10-17 Mark Eggleston + + * 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 * 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 index 00000000000..35f6e0fa27d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/auto_in_equiv_3.f90 @@ -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 index 00000000000..3188f19f2cf --- /dev/null +++ b/gcc/testsuite/gfortran.dg/auto_in_equiv_4.f90 @@ -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 index 00000000000..d1e08a6600e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/auto_in_equiv_5.f90 @@ -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 index 00000000000..f4135218d41 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/auto_in_equiv_6.f90 @@ -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 index 00000000000..fd7e6721383 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/auto_in_equiv_7.f90 @@ -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" } } + -- 2.11.4.GIT