[Patch, Fortran] PR55763 - improve init-data checks for pointers

Tobias Burnus burnus@net-b.de
Sun Jan 6 14:40:00 GMT 2013


Early * ping*
http://gcc.gnu.org/ml/fortran/2013-01/msg00025.html


On January 4, 2013, Tobias Burnus wrote:
> Fortran 2008 allows:
>    integer :: pointer => init_data
> and
>   type t
>      integer :: pointer => init_data
>   end type t
>
> The current check in gfc_check_assign_symbol was only called for 
> former and for constructors, but not for the type definition. 
> Additionally, BT_CLASS wasn't handled. I also improved the error 
> location.
>
>
>
> The patch has a downside: One gets some messages twice or trice: Once 
> for resolving the type declaration ("type t") and then for resolving 
> the default initialization via
>    gfc_traverse_ns (ns, resolve_values);
>
> Currently, that's unavoidable as one cannot trivially distinguish 
> between a user-supplied "sym->value" and the default constructor. If 
> you think that this is a problem, one can change it, e.g. by setting a 
> sym->attr.value_is_default_init.
>
>
> Build and regtested on x86-64-gnu-linux.
> OK for the trunk?
>
> Tobias
>
> PS: For CLASS pointers, there will be an ICE if one tries to associate 
> a variable to them; that's unchanged by this patch.



More information about the Gcc-patches mailing list