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 42207/44064/44065: Undefined reference to vtab$...


Hi all,

the attached patch takes care of the OOP-related linking problems.
AFAICS, it fixes all of PR 42207, 44064 and 44065. The problem was
that in certain situations the vtables were generated too late (i.e.
at translation stage), so that no module variables were generated for
them (this is done in 'gfc_generate_module_vars', which is being
called after resolution). The fix is to call gfc_find_derived_vtab at
resolution stage, to make sure the vtab symbols are present.

The patch also contains a few improvements for gfc_find_derived_vtab:
1) It makes sure that no vtabs are generated for class container
types, but only for the underlying derived type.
2) It cleans up a small error (the reference count for the vtab
symbols was increased for no reason).
3) It follows a suggestion by Mikael to commit the vtab and vtype
symbols one by one (cf. PR 42207 comment #14).

I have included two test cases: The first one is basically comment #4
from PR42207, the second one is comment #3 from PR44065.

Regtested on x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus



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

	PR fortran/42207
	PR fortran/44064
	PR fortran/44065
	* class.c (gfc_find_derived_vtab): Do not generate vtabs for class
	container types. Do not artificially increase refs. Commit symbols one
	by one.
	* interface.c (compare_parameter): Make sure vtabs are present before
	generating module variables.
	* resolve.c (resolve_allocate_expr): Ditto.


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

	PR fortran/42207
	PR fortran/44064
	PR fortran/44065
	* gfortran.dg/class_25.f03: New.
	* gfortran.dg/class_26.f03: New.

Attachment: pr44065.diff
Description: Binary data

Attachment: class_25.f03
Description: Binary data

Attachment: class_26.f03
Description: Binary data


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