aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2007-07-03 23:41:34 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2007-07-03 23:41:34 +0200
commitad22b1ff95b37a2ba2c54fa7dc4c4978784c60d4 (patch)
tree6a6d3d1c0c69af604de2ff9192a48191169ecb07 /gcc/testsuite
parent717c4e47fbf53b293b5c23fe8717e504895a5bb4 (diff)
downloadgcc-ad22b1ff95b37a2ba2c54fa7dc4c4978784c60d4.zip
gcc-ad22b1ff95b37a2ba2c54fa7dc4c4978784c60d4.tar.gz
gcc-ad22b1ff95b37a2ba2c54fa7dc4c4978784c60d4.tar.bz2
re PR fortran/25062 (same name for parameter and common block)
2007-07-03 Tobias Burnus <burnus@net-b.de> PR fortran/25062 * resolve.c (resolve_common_blocks): New check function. (resolve_types): Use it. 2007-07-03 Tobias Burnus <burnus@net-b.de> PR fortran/25062 * common_7.f90: New. * common_8.f90: New. * common_9.f90: New. From-SVN: r126279
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gfortran.dg/common_7.f9011
-rw-r--r--gcc/testsuite/gfortran.dg/common_8.f9032
-rw-r--r--gcc/testsuite/gfortran.dg/common_9.f9023
4 files changed, 73 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 934a38b..e6b2268 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,12 @@
2007-07-03 Tobias Burnus <burnus@net-b.de>
+ PR fortran/25062
+ * common_7.f90: New.
+ * common_8.f90: New.
+ * common_9.f90: New.
+
+2007-07-03 Tobias Burnus <burnus@net-b.de>
+
PR fortran/30940
* gfortran.dg/argument_checking_1.f90: New.
* gfortran.dg/argument_checking_2.f90: New.
diff --git a/gcc/testsuite/gfortran.dg/common_7.f90 b/gcc/testsuite/gfortran.dg/common_7.f90
new file mode 100644
index 0000000..2736cad
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/common_7.f90
@@ -0,0 +1,11 @@
+! { dg-do compile }
+!
+! F2003: 16.2.1
+! "A name that identifies a common block in a scoping unit shall not be used
+! to identify a constant or an intrinsic procedure in that scoping unit."
+!
+subroutine x134
+ INTEGER, PARAMETER :: C1=1 ! { dg-error "COMMON block 'c1' at \\(1\\) is used as PARAMETER" }
+ COMMON /C1/ I ! { dg-error "COMMON block 'c1' at \\(1\\) is used as PARAMETER" }
+end subroutine
+end
diff --git a/gcc/testsuite/gfortran.dg/common_8.f90 b/gcc/testsuite/gfortran.dg/common_8.f90
new file mode 100644
index 0000000..5d08fcd
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/common_8.f90
@@ -0,0 +1,32 @@
+! { dg-do compile }
+!
+! PR fortran/25062
+!
+! F2003: 16.2.1
+! "A name that identifies a common block in a scoping unit shall not be used
+! to identify a constant or an intrinsic procedure in that scoping unit."
+!
+subroutine try
+ implicit none
+ COMMON /s/ J
+ COMMON /bar/ I
+ INTEGER I, J
+ real s, x
+ s(x)=sin(x)
+ print *, s(5.0)
+ call bar()
+contains
+ subroutine bar
+ print *, 'Hello world'
+ end subroutine bar
+
+end subroutine try
+
+program test
+ implicit none
+ COMMON /abs/ J ! { dg-error "is also an intrinsic procedure" }
+ intrinsic :: abs
+ INTEGER J
+ external try
+ call try
+end program test
diff --git a/gcc/testsuite/gfortran.dg/common_9.f90 b/gcc/testsuite/gfortran.dg/common_9.f90
new file mode 100644
index 0000000..a567eb3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/common_9.f90
@@ -0,0 +1,23 @@
+! { dg-do compile }
+! { dg-options "-std=f95" }
+
+! PR fortran/25062
+!
+! F95: 14.1.2.1:
+! "A common block name in a scoping unit also may be the name of any local
+! entity other than a named constant, intrinsic procedure, or a local variable
+! that is also an external function in a function subprogram."
+!
+! F2003: 16.2.1
+! "A name that identifies a common block in a scoping unit shall not be used
+! to identify a constant or an intrinsic procedure in that scoping unit. If
+! a local identifier is also the name of a common block, the appearance of
+! that name in any context other than as a common block name in a COMMON
+! or SAVE statement is an appearance of the local identifier."
+!
+function func1() result(res)
+ implicit none
+ real res, r
+ common /res/ r ! { dg-error "is also a function result" }
+end function func1
+end