OSDN Git Service

2012-06-13 Tobias Burnus <burnus@net-b.de>
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Jun 2012 11:56:08 +0000 (11:56 +0000)
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Jun 2012 11:56:08 +0000 (11:56 +0000)
        PR fortran/53597
        * decl.c (match_attr_spec): Only mark module variables
        as SAVE_IMPLICIT for Fortran 2008 and later.

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

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@188506 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 02b6445..ffe1254 100644 (file)
@@ -1,3 +1,9 @@
+2012-06-13  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-08  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/52552
index a760331..26b5059 100644 (file)
@@ -3810,8 +3810,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 cdeb722..3649dcf 100644 (file)
@@ -1,3 +1,8 @@
+2012-06-13  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/53597
+       * gfortran.dg/save_4.f90: New.
+
 2012-06-12  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/53532
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