]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/20847 (common block object may not have save attribute)
authorPaul Thomas <pault@gcc.gnu.org>
Wed, 12 Oct 2005 20:05:04 +0000 (20:05 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Wed, 12 Oct 2005 20:05:04 +0000 (20:05 +0000)
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

gcc/fortran/ChangeLog
gcc/fortran/symbol.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/save_common.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/save_result.f90 [new file with mode: 0644]

index b7eec3342f4f48fd4ccaaaddc74ec126d979258f..a02586f1758a5ad4ef40458fecea6933d5556a26 100644 (file)
@@ -1,3 +1,11 @@
+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
index aceac5b7423e204812aa95f68aac307327bb7544..98ce66fef98da861af621e6b7bb83214ae780b5f 100644 (file)
@@ -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);
index 9c14e0d2173a8425256ca46b5ccca8e89b3810a4..366ef0a073efc5cc0a873e939708efc6a581c055 100644 (file)
@@ -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 (file)
index 0000000..df4c84f
--- /dev/null
@@ -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 (file)
index 0000000..9e295ec
--- /dev/null
@@ -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