re PR fortran/53597 (F95/F2003 constraint no longer triggers: un-SAVED default-initialized module variable)

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: r188614
This commit is contained in:
Tobias Burnus 2012-06-14 15:00:50 +02:00 committed by Tobias Burnus
parent 115abf2f23
commit ff5658b6e9
4 changed files with 27 additions and 2 deletions

View 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-14 Release Manager
* GCC 4.7.1 released.

View File

@ -3786,8 +3786,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;

View 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-14 Richard Guenther <rguenther@suse.de>
Backport from mainline

View File

@ -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