diff options
author | Mark Eggleston <mark.eggleston@codethink.com> | 2019-10-17 10:39:49 +0000 |
---|---|---|
committer | Mark Eggleston <markeggleston@gcc.gnu.org> | 2019-10-17 10:39:49 +0000 |
commit | c95ee96bee5db83038e931750c0866608a59107c (patch) | |
tree | 54b66fec4d8f3a916a56162cbbefac2ea6c952d0 | |
parent | 7fa848b52615cc1e937c07b20e640a7379bbdfa0 (diff) | |
download | gcc-c95ee96bee5db83038e931750c0866608a59107c.zip gcc-c95ee96bee5db83038e931750c0866608a59107c.tar.gz gcc-c95ee96bee5db83038e931750c0866608a59107c.tar.bz2 |
Additional test cases for using automatic variables in equivalence statements.
From-SVN: r277097
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/auto_in_equiv_3.f90 | 19 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/auto_in_equiv_4.f90 | 18 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/auto_in_equiv_5.f90 | 18 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/auto_in_equiv_6.f90 | 18 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/auto_in_equiv_7.f90 | 19 |
6 files changed, 100 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 65e80d5..401149a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 index 0000000..35f6e0f --- /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 0000000..3188f19 --- /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 0000000..d1e08a6 --- /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 0000000..f413521 --- /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 0000000..fd7e672 --- /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" } } + |