[Patch, Fortran, OOP] PR 45290/45271: pointer initialization / vtab init

Janus Weil janus@gcc.gnu.org
Fri Aug 20 09:49:00 GMT 2010


Hi all,

this patch fixes PR 45271 by giving static initializers to the PPC
components of the vtabs. This is made possible by the recent progress
on pointer initialization (PR 45290). A prerequisite for vtab
initialization was fixing comment #6 of that PR, which is accomplished
simply by removing an 'gcc_assert' in 'build_function_decl'.

The central pieces of the patch are:
1) Setting up the initializer in class.c (add_proc_comp).
2) Removing 'gfc_trans_assign_vtab_procs', which handled the dynamic
initialization of the vtab PPCs at runtime.

Moreover some supplemental changes were needed, namely:
3) Modifying 'gfc_conv_initializer' to handle intialization of
array-valued procedure pointers.
4) Modifying 'mio_component' to skip the initializers of the vtabs.
This was done to fix a regression on class_15.f03. The initializers
are actually only needed in the original module where the vtab is set
up, but not anywhere else.

The patch was regtested on x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus


2010-08-20  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/45271
	PR fortran/45290
	* class.c (add_proc_comp): Add static initializer for PPCs.
	(add_procs_to_declared_vtab): Modified comment.
	* module.c (mio_component): Add argument 'vtype'. Don't read/write the
	initializer if the component is part of a vtype.
	(mio_component_list): Add argument 'vtype', pass it on to
	'mio_component'.
	(mio_symbol): Modified call to 'mio_component_list'.
	* trans.h (gfc_conv_initializer): Modified prototype.
	(gfc_trans_assign_vtab_procs): Removed.
	* trans-common.c (create_common): Modified call to
	'gfc_conv_initializer'.
	* trans-decl.c (gfc_get_symbol_decl,get_proc_pointer_decl,
	gfc_emit_parameter_debug_info): Modified call to
	'gfc_conv_initializer'.
	(build_function_decl): Remove assertion.
	* trans-expr.c (gfc_conv_derived_to_class,gfc_trans_class_assign):
	Removed call to 'gfc_trans_assign_vtab_procs'.
	(gfc_conv_initializer): Add argument 'procptr'.
	(gfc_conv_structure): Modified call to 'gfc_conv_initializer'.
	(gfc_trans_assign_vtab_procs): Removed.
	* trans-stmt.c (gfc_trans_allocate): Removed call to
	'gfc_trans_assign_vtab_procs'.


2010-08-20  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/45271
	PR fortran/45290
	* gfortran.dg/pointer_init_5.f90: New.
	* gfortran.dg/typebound_call_18.f03: New.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtab_init.diff
Type: application/octet-stream
Size: 11776 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20100820/a1ec08f1/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pointer_init_5.f90
Type: application/octet-stream
Size: 525 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20100820/a1ec08f1/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: typebound_call_18.f03
Type: application/octet-stream
Size: 1882 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20100820/a1ec08f1/attachment-0002.obj>


More information about the Fortran mailing list