http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49112
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Missing type-bound |[4.6/4.7 Regression] [OOP]
|procedure, "duplicate save" |Missing type-bound
|warnings and internal |procedure, "duplicate save"
|compiler error |warnings and internal
| |compiler error
--- Comment #5 from janus at gcc dot gnu.org 2011-05-28 10:03:36 UTC ---
(In reply to comment #4)
> SAVE can be either a statement or an attribute. When it's statement, it
> affects all the variables within the containing unit
Yes, of course. I completely forgot about this possibility.
Btw, the code in comment #3 works with gfortran 4.5, so it is in fact a
regression.
> 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.
This is at best a "double save", and I think the (F08) standard forbids it:
C580 (R553) If a SAVE statement with an omitted saved entity list appears in a
scoping unit, no other appearance of the SAVE attr-spec or SAVE statement is
permitted in that scoping unit.
So I think in this case gfortran correctly complains about a "Duplicate SAVE
attribute".