]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/53597 (F95/F2003 constraint no longer triggers: un-SAVED default-initia...
authorTobias Burnus <burnus@net-b.de>
Thu, 14 Jun 2012 13:11:27 +0000 (15:11 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Thu, 14 Jun 2012 13:11:27 +0000 (15:11 +0200)
2012-06-14  Tobias Burnus  <burnus@net-b.de>

        PR fortran/53597
        * decl.c (match_attr_spec): Only mark module variables
        as SAVE_IMPLICIT for Fortran 2008 and later.

2012-06-14  Tobias Burnus  <burnus@net-b.de>

        PR fortran/53597
        * gfortran.dg/save_4.f90: New.

From-SVN: r188618

gcc/fortran/ChangeLog
gcc/fortran/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/save_4.f90 [new file with mode: 0644]

index 0d779f93f3450e9aa459437eb0a0f5b9c09e1fe4..b752efb264d3b386fa3f32be97da59ccbd3fa801 100644 (file)
@@ -1,3 +1,9 @@
+2012-06-14  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/53597
+       * decl.c (match_attr_spec): Only mark module variables
+       as SAVE_IMPLICIT for Fortran 2008 and later.
+
 2012-06-05  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/50619
index 90693a4b858d40e5ea6e593d562fcf0c76971871..26bffb78baf960712fc6689ca71b971637287b65 100644 (file)
@@ -3623,8 +3623,9 @@ match_attr_spec (void)
        }
     }
 
-  /* Module variables implicitly have the SAVE attribute.  */
-  if (gfc_current_state () == COMP_MODULE && !current_attr.save)
+  /* Since Fortran 2008 module variables implicitly have the SAVE attribute.  */
+  if (gfc_current_state () == COMP_MODULE && !current_attr.save
+      && (gfc_option.allow_std & GFC_STD_F2008) != 0)
     current_attr.save = SAVE_IMPLICIT;
 
   colon_seen = 1;
index 7bb2362ff286b618b866b65a6fa754b5c3f7ebb6..4faab1465289778737245657c4c8825ccfd075c0 100644 (file)
@@ -1,3 +1,8 @@
+2012-06-14  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/53597
+       * gfortran.dg/save_4.f90: New.
+
 2012-06-13  Christian Bruel  <christian.bruel@st.com>
 
        PR target/53621
diff --git a/gcc/testsuite/gfortran.dg/save_4.f90 b/gcc/testsuite/gfortran.dg/save_4.f90
new file mode 100644 (file)
index 0000000..74ea6e8
--- /dev/null
@@ -0,0 +1,13 @@
+! { dg-do compile }
+! { dg-options "-std=f2003" }
+!
+! PR fortran/53597
+!
+MODULE somemodule
+  IMPLICIT NONE
+  TYPE sometype
+    INTEGER :: i
+    DOUBLE PRECISION, POINTER, DIMENSION(:,:) :: coef => NULL()
+  END TYPE sometype
+  TYPE(sometype) :: somevariable ! { dg-error "Fortran 2008: Implied SAVE for module variable 'somevariable' at .1., needed due to the default initialization" }
+END MODULE somemodule