aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorJanus Weil <janus@gcc.gnu.org>2014-03-15 11:53:04 +0100
committerJanus Weil <janus@gcc.gnu.org>2014-03-15 11:53:04 +0100
commit68a230443864dcefe9e368997d65e1d1777d6fc8 (patch)
tree0ce2dd6ab88df97b2dc29e5e4fbeaba86bff6196 /gcc/fortran
parentcfce90ac4ae6b35764990e0c306be61e45b97dbd (diff)
downloadgcc-68a230443864dcefe9e368997d65e1d1777d6fc8.zip
gcc-68a230443864dcefe9e368997d65e1d1777d6fc8.tar.gz
gcc-68a230443864dcefe9e368997d65e1d1777d6fc8.tar.bz2
re PR fortran/55207 ([F08] Variables declared in the main program should implicitly get the SAVE attribute)
2014-03-15 Janus Weil <janus@gcc.gnu.org> PR fortran/55207 * decl.c (match_attr_spec): Variables in the main program implicitly get the SAVE attribute in Fortran 2008. 2014-03-15 Janus Weil <janus@gcc.gnu.org> PR fortran/55207 * gfortran.dg/assumed_rank_7.f90: Explicitly deallocate variables. * gfortran.dg/c_ptr_tests_16.f90: Put into subroutine. * gfortran.dg/inline_sum_bounds_check_1.f90: Add -Wno-aggressive-loop-optimizations and remove an unused variable. * gfortran.dg/intent_optimize_1.f90: Put into subroutine. * gfortran.dg/pointer_init_9.f90: New. * gfortran.dg/volatile4.f90: Put into subroutine. * gfortran.dg/volatile6.f90: Ditto. From-SVN: r208590
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/decl.c8
2 files changed, 11 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index ba4bdf0..ce4063e 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2014-03-15 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/55207
+ * decl.c (match_attr_spec): Variables in the main program implicitly
+ get the SAVE attribute in Fortran 2008.
+
2014-03-14 Mikael Morin <mikael@gcc.gnu.org>
PR fortran/60392
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 2d405fe..c7f5eed 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -3827,9 +3827,11 @@ match_attr_spec (void)
}
}
- /* 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)
+ /* Since Fortran 2008, variables declared in a MODULE or PROGRAM
+ implicitly have the SAVE attribute. */
+ if ((gfc_current_state () == COMP_MODULE
+ || gfc_current_state () == COMP_PROGRAM)
+ && !current_attr.save && (gfc_option.allow_std & GFC_STD_F2008) != 0)
current_attr.save = SAVE_IMPLICIT;
colon_seen = 1;