mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-08 10:50:47 +08:00
re PR fortran/43185 ([F2008] Implicit SAVE in MODULEs)
2010-02-27 Tobias Burnus <burnus@net-b.de> PR fortran/43185 * resolve.c (resolve_fl_variable_derived): Imply SAVE for module variables for Fortran 2008. 2010-02-27 Tobias Burnus <burnus@net-b.de> PR fortran/43185 * gfortran.dg/default_initialization_1.f90: Add -std=f2003. * gfortran.dg/default_initialization_4.f90: New test. From-SVN: r157109
This commit is contained in:
parent
58f1b7061e
commit
cea2d589bd
@ -1,3 +1,9 @@
|
||||
2010-02-27 Tobias Burnus <burnus@net-b.de>
|
||||
|
||||
PR fortran/43185
|
||||
* resolve.c (resolve_fl_variable_derived): Imply SAVE
|
||||
for module variables for Fortran 2008.
|
||||
|
||||
2010-02-25 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR debug/43166
|
||||
|
@ -8937,13 +8937,12 @@ resolve_fl_variable_derived (gfc_symbol *sym, int no_init_flag)
|
||||
&& sym->ns->proc_name->attr.flavor == FL_MODULE
|
||||
&& !sym->ns->save_all && !sym->attr.save
|
||||
&& !sym->attr.pointer && !sym->attr.allocatable
|
||||
&& has_default_initializer (sym->ts.u.derived))
|
||||
{
|
||||
gfc_error("Object '%s' at %L must have the SAVE attribute for "
|
||||
"default initialization of a component",
|
||||
sym->name, &sym->declared_at);
|
||||
return FAILURE;
|
||||
}
|
||||
&& has_default_initializer (sym->ts.u.derived)
|
||||
&& gfc_notify_std (GFC_STD_F2008, "Fortran 2008: Implied SAVE for "
|
||||
"module variable '%s' at %L, needed due to "
|
||||
"the default initialization", sym->name,
|
||||
&sym->declared_at) == FAILURE)
|
||||
return FAILURE;
|
||||
|
||||
if (sym->ts.type == BT_CLASS)
|
||||
{
|
||||
|
@ -1,3 +1,9 @@
|
||||
2010-02-27 Tobias Burnus <burnus@net-b.de>
|
||||
|
||||
PR fortran/43185
|
||||
* gfortran.dg/default_initialization_1.f90: Add -std=f2003.
|
||||
* gfortran.dg/default_initialization_4.f90: New test.
|
||||
|
||||
2010-02-27 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gnat.dg/thin_pointer.ad[sb]: Rename into...
|
||||
|
@ -1,6 +1,7 @@
|
||||
!
|
||||
! { dg-do compile }
|
||||
! PR 20845
|
||||
! { dg-options "-std=f2003" }
|
||||
! PR 20845; for F2008: PR fortran/43185
|
||||
!
|
||||
! In ISO/IEC 1539-1:1997(E), 4th constraint in section 11.3:
|
||||
!
|
||||
|
22
gcc/testsuite/gfortran.dg/default_initialization_4.f90
Normal file
22
gcc/testsuite/gfortran.dg/default_initialization_4.f90
Normal file
@ -0,0 +1,22 @@
|
||||
!
|
||||
! { dg-do run }
|
||||
!
|
||||
! PR fortran/43185
|
||||
!
|
||||
! The following is valid F2008 but not valid Fortran 90/2003
|
||||
! Cf. PR 20845
|
||||
!
|
||||
module good
|
||||
implicit none
|
||||
type default_initialization
|
||||
integer :: x = 42
|
||||
end type default_initialization
|
||||
type (default_initialization) t ! OK in F2008
|
||||
end module good
|
||||
|
||||
use good
|
||||
if (t%x /= 42) call abort()
|
||||
t%x = 0
|
||||
if (t%x /= 0) call abort()
|
||||
end
|
||||
! { dg-final { cleanup-modules "good" } }
|
Loading…
x
Reference in New Issue
Block a user