http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49112
--- Comment #4 from John <jwmwalrus at gmail dot com> 2011-05-22 17:58:39 UTC --- (In reply to comment #3) > (In reply to comment #0) > > ...:~$ gfortran -c test_gfortran_ice.f90 > > test_gfortran_ice.f90:20.41: > > > > class(DateTime), intent(IN) :: dt > > 1 > > Warning: Duplicate SAVE attribute specified at (1) > > test_gfortran_ice.f90:20.41: > > > > class(DateTime), intent(IN) :: dt > > 1 > > Warning: Duplicate SAVE attribute specified at (1) > > > Here is a reduced test case for the duplicate SAVE attribute: > > > module datetime_mod > > implicit none > save > > type :: DateTime > end type > > contains > > character function getString (dt) > class(DateTime) :: dt > end function > > end module > > > At first glance I would save this is invalid, and should be rejected with an > error. In particular, is it allowed to give a lonely SAVE statement? If yes, > what effect should this have? Usually SAVE is specified as an attribute for a > specific variable, right? SAVE can be either a statement or an attribute. When it's statement, it affects all the variables within the containing unit (e.g., in the case of a module, it affects all the variables declared before the "contains"). When it's the attribute for a particular variable declaration, it affects the variable only. Since in Fortran initialization implies SAVE, and the ISO_REFERENCE_DATE is being (sort of) initialized, the compiler is assuming a duplicate SAVE. The standard also allows the confirmation, as an attribute, of the SAVE at the module level, so, for a "triple save" example: module t1_mod save type :: t1 integer :: dummy = 0 end type type(t1), save :: a = t1(2), b = t1(3) end type Which also triggers a duplicate save warning.