This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

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


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.

Attachment: vtab_init.diff
Description: Binary data

Attachment: pointer_init_5.f90
Description: Binary data

Attachment: typebound_call_18.f03
Description: Binary data


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