http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57306

--- Comment #8 from janus at gcc dot gnu.org ---
(In reply to janus from comment #7)
> Here is a reduced version of the test case from
> http://gcc.gnu.org/ml/fortran/2013-07/msg00103.html, which for some reason
> still ICEs:
> 
> 
>   type :: c
>   end type c
> 
>   type(c), target :: x
>   class(c), pointer :: px => x
> 
>   if (.not. associated(px)) call abort()
> end 

Putting this inside a subroutine, one gets:

  class(c), pointer :: px => x
                              1
Error: Pointer initialization target at (1) must have the SAVE attribute


Giving 'x' the SAVE attribute makes both versions compile without error. I
guess the original version is still valid, since 'x' should implicitly get the
SAVE attribute [1]. However, without the explicit SAVE declaration, it is not
shown as 'static' in the dump.


[1] F08, section 5.3.16: "A variable, common block, or procedure pointer
declared in the scoping unit of a main program, module, or submodule implicitly
has the SAVE attribute, which may be confirmed by explicit specification."

Reply via email to