This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]