|
|
3db796 |
From 52e49e5edaf2c4de5974b42dd359c0f57546c640 Mon Sep 17 00:00:00 2001
|
|
|
3db796 |
From: Mark Doffman <mark.doffman@codethink.co.uk>
|
|
|
3db796 |
Date: Thu, 5 Jun 2014 20:47:51 +0000
|
|
|
3db796 |
Subject: [PATCH 19/23] Add tests for AUTOMATIC keyword
|
|
|
3db796 |
|
|
|
3db796 |
These tests were written by Mark Doffman for his own implementation of
|
|
|
3db796 |
the AUTOMATIC keyword. Since then, Fritz Reese's implementation was
|
|
|
3db796 |
merged upstream so we no longer carry Mark's patches but the tests
|
|
|
3db796 |
may add some useful extra test coverage. Or they might not.
|
|
|
3db796 |
---
|
|
|
3db796 |
gcc/testsuite/gfortran.dg/automatic_1.f90 | 31 ++++++++++++++++++++++++++
|
|
|
3db796 |
gcc/testsuite/gfortran.dg/automatic_common.f90 | 6 +++++
|
|
|
3db796 |
gcc/testsuite/gfortran.dg/automatic_repeat.f90 | 8 +++++++
|
|
|
3db796 |
gcc/testsuite/gfortran.dg/automatic_save.f90 | 8 +++++++
|
|
|
3db796 |
4 files changed, 53 insertions(+)
|
|
|
3db796 |
create mode 100644 gcc/testsuite/gfortran.dg/automatic_1.f90
|
|
|
3db796 |
create mode 100644 gcc/testsuite/gfortran.dg/automatic_common.f90
|
|
|
3db796 |
create mode 100644 gcc/testsuite/gfortran.dg/automatic_repeat.f90
|
|
|
3db796 |
create mode 100644 gcc/testsuite/gfortran.dg/automatic_save.f90
|
|
|
3db796 |
|
|
|
3db796 |
diff --git a/gcc/testsuite/gfortran.dg/automatic_1.f90 b/gcc/testsuite/gfortran.dg/automatic_1.f90
|
|
|
3db796 |
new file mode 100644
|
|
|
3db796 |
index 0000000..910dcb1
|
|
|
3db796 |
--- /dev/null
|
|
|
3db796 |
+++ b/gcc/testsuite/gfortran.dg/automatic_1.f90
|
|
|
3db796 |
@@ -0,0 +1,31 @@
|
|
|
3db796 |
+! { dg-do run }
|
|
|
3db796 |
+! { dg-options "-O2 -fdec-static -fno-automatic" }
|
|
|
3db796 |
+ subroutine foo (b)
|
|
|
3db796 |
+ logical b
|
|
|
3db796 |
+ integer i, j
|
|
|
3db796 |
+ character*24 s
|
|
|
3db796 |
+ automatic i
|
|
|
3db796 |
+ if (b) then
|
|
|
3db796 |
+ i = 26
|
|
|
3db796 |
+ j = 131
|
|
|
3db796 |
+ s = 'This is a test string'
|
|
|
3db796 |
+ else
|
|
|
3db796 |
+ if (i .eq. 26 .or. j .ne. 131) call abort
|
|
|
3db796 |
+ if (s .ne. 'This is a test string') call abort
|
|
|
3db796 |
+ end if
|
|
|
3db796 |
+ end subroutine foo
|
|
|
3db796 |
+ subroutine bar (s)
|
|
|
3db796 |
+ character*42 s
|
|
|
3db796 |
+ if (s .ne. '0123456789012345678901234567890123456') call abort
|
|
|
3db796 |
+ call foo (.false.)
|
|
|
3db796 |
+ end subroutine bar
|
|
|
3db796 |
+ subroutine baz
|
|
|
3db796 |
+ character*42 s
|
|
|
3db796 |
+ ! Just clobber stack a little bit.
|
|
|
3db796 |
+ s = '0123456789012345678901234567890123456'
|
|
|
3db796 |
+ call bar (s)
|
|
|
3db796 |
+ end subroutine baz
|
|
|
3db796 |
+ call foo (.true.)
|
|
|
3db796 |
+ call baz
|
|
|
3db796 |
+ call foo (.false.)
|
|
|
3db796 |
+ end
|
|
|
3db796 |
diff --git a/gcc/testsuite/gfortran.dg/automatic_common.f90 b/gcc/testsuite/gfortran.dg/automatic_common.f90
|
|
|
3db796 |
new file mode 100644
|
|
|
3db796 |
index 0000000..5ec016f
|
|
|
3db796 |
--- /dev/null
|
|
|
3db796 |
+++ b/gcc/testsuite/gfortran.dg/automatic_common.f90
|
|
|
3db796 |
@@ -0,0 +1,6 @@
|
|
|
3db796 |
+! { dg-do compile }
|
|
|
3db796 |
+! { dg-options "-fdec-static" }
|
|
|
3db796 |
+! A common variable may not have the AUTOMATIC attribute.
|
|
|
3db796 |
+INTEGER, AUTOMATIC :: X
|
|
|
3db796 |
+COMMON /COM/ X ! { dg-error "conflicts with AUTOMATIC attribute" }
|
|
|
3db796 |
+END
|
|
|
3db796 |
diff --git a/gcc/testsuite/gfortran.dg/automatic_repeat.f90 b/gcc/testsuite/gfortran.dg/automatic_repeat.f90
|
|
|
3db796 |
new file mode 100644
|
|
|
3db796 |
index 0000000..5c3133a
|
|
|
3db796 |
--- /dev/null
|
|
|
3db796 |
+++ b/gcc/testsuite/gfortran.dg/automatic_repeat.f90
|
|
|
3db796 |
@@ -0,0 +1,8 @@
|
|
|
3db796 |
+! { dg-do compile }
|
|
|
3db796 |
+! { dg-options "-fdec-static" }
|
|
|
3db796 |
+! An AUTOMATIC statement cannot duplicated
|
|
|
3db796 |
+FUNCTION X()
|
|
|
3db796 |
+REAL, AUTOMATIC, AUTOMATIC :: Y ! { dg-error "Duplicate AUTOMATIC attribute" }
|
|
|
3db796 |
+y = 1
|
|
|
3db796 |
+END FUNCTION X
|
|
|
3db796 |
+END
|
|
|
3db796 |
diff --git a/gcc/testsuite/gfortran.dg/automatic_save.f90 b/gcc/testsuite/gfortran.dg/automatic_save.f90
|
|
|
3db796 |
new file mode 100644
|
|
|
3db796 |
index 0000000..2455d20
|
|
|
3db796 |
--- /dev/null
|
|
|
3db796 |
+++ b/gcc/testsuite/gfortran.dg/automatic_save.f90
|
|
|
3db796 |
@@ -0,0 +1,8 @@
|
|
|
3db796 |
+! { dg-do compile }
|
|
|
3db796 |
+! { dg-options "-fdec-static" }
|
|
|
3db796 |
+! An AUTOMATIC statement cannot be used with SAVE
|
|
|
3db796 |
+FUNCTION X()
|
|
|
3db796 |
+REAL, SAVE, AUTOMATIC :: Y ! { dg-error "AUTOMATIC attribute conflicts with SAVE attribute" }
|
|
|
3db796 |
+y = 1
|
|
|
3db796 |
+END FUNCTION X
|
|
|
3db796 |
+END
|
|
|
3db796 |
--
|
|
|
3db796 |
2.9.5
|
|
|
3db796 |
|