aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2005-10-12 20:05:04 +0000
committerPaul Thomas <pault@gcc.gnu.org>2005-10-12 20:05:04 +0000
commit96b95725509f2a63c2be09e9953a50d6f060cbea (patch)
treeabc1cad029a8771cdb8273bbb5c57a8dfdc1284f
parent4def9c5307aa70afe92896aa4e2e4f350df4ae74 (diff)
downloadgcc-96b95725509f2a63c2be09e9953a50d6f060cbea.zip
gcc-96b95725509f2a63c2be09e9953a50d6f060cbea.tar.gz
gcc-96b95725509f2a63c2be09e9953a50d6f060cbea.tar.bz2
re PR fortran/20847 (common block object may not have save attribute)
2005-10-12 Paul Thomas <pault@gcc.gnu.org> PR fortran/20847 PR fortran/20856 * symbol.c (check_conflict): Prevent common variables and function results from having the SAVE attribute,as required by the standard. 2005-10-12 Paul Thomas <pault@gcc.gnu.org> PR fortran/20847 gfortran.dg/save_common.f90: New test. PR fortran/20856 gfortran.dg/save_result.f90: New test. From-SVN: r105325
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/symbol.c3
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/gfortran.dg/save_common.f906
-rw-r--r--gcc/testsuite/gfortran.dg/save_result.f908
5 files changed, 33 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index b7eec33..a02586f 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,13 @@
2005-10-12 Paul Thomas <pault@gcc.gnu.org>
+ PR fortran/20847
+ PR fortran/20856
+ * symbol.c (check_conflict): Prevent common variables and
+ function results from having the SAVE attribute,as required
+ by the standard.
+
+2005-10-12 Paul Thomas <pault@gcc.gnu.org>
+
PR fortran/24207
* resolve.c (resolve_symbol): Exclude use and host associated
symbols from the test for private objects in a public namelist.
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index aceac5b..98ce66f 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -322,6 +322,9 @@ check_conflict (symbol_attribute * attr, const char * name, locus * where)
conf (in_common, dummy);
conf (in_common, allocatable);
conf (in_common, result);
+ conf (in_common, save);
+ conf (result, save);
+
conf (dummy, result);
conf (in_equivalence, use_assoc);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9c14e0d..366ef0a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2005-10-12 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/20847
+ gfortran.dg/save_common.f90: New test.
+
+ PR fortran/20856
+ gfortran.dg/save_result.f90: New test.
+
2005-10-12 Nathan Sidwell <nathan@codesourcery.com>
PR c++/21592
diff --git a/gcc/testsuite/gfortran.dg/save_common.f90 b/gcc/testsuite/gfortran.dg/save_common.f90
new file mode 100644
index 0000000..df4c84f9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/save_common.f90
@@ -0,0 +1,6 @@
+! { dg-do compile }
+! PR20847 - A common variable may not have the SAVE attribute.
+! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
+INTEGER, SAVE :: X
+COMMON /COM/ X ! { dg-error "conflicts with SAVE attribute" }
+END \ No newline at end of file
diff --git a/gcc/testsuite/gfortran.dg/save_result.f90 b/gcc/testsuite/gfortran.dg/save_result.f90
new file mode 100644
index 0000000..9e295ec
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/save_result.f90
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR20856 - A function result may not have SAVE attribute.
+! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
+FUNCTION X() RESULT(Y)
+REAL, SAVE :: Y ! { dg-error "RESULT attribute conflicts with SAVE" }
+y = 1
+END FUNCTION X
+END \ No newline at end of file