[Patch, fortran] PR58007: unresolved fixup hell

Mikael Morin mikael.morin@sfr.fr
Thu Jan 2 11:41:00 GMT 2014


Hello,

this patch fixes PR58007, where the compiler was not able to relate a
component pointer to any loaded derived type symbol.
The problem came from an optimization avoiding loading again a symbol
which had already been loaded, skipping by the way the association of
component pointers (if the symbol was a derived type) with the
corresponding module indexes.

The attached patch fixes this by reading the derived type symbol dump's
component list and do the pointer<->integer association by hand.  Then
the regular on demand module loading code works properly and some code
in mio_component_ref that was forcing the module loading of the
containing derived type can be removed.
To associate the component pointers with the module integers, one has to
parse the symbol, or at least its components.  It is done by hand in
this patch and to reduce the maintainance burden (for possible future
evolutions of symbol dumping format/content) the component list is moved
at the beginning.  More exactly just after the symbol attributes,
because the check_for_ambiguous function relies on the symbol attributes
appearing first in a symbol.
This changes the module format, so MOD_VERSION is  bumped.

Regression tested on x86_64-unknown-linux-gnu. OK for trunk?
I plan to submit a variant that doesn't change the module format for the
branches (doing more parsing by hand).

Mikael








-------------- next part --------------

2014-01-02  Mikael Morin  <mikael@gcc.gnu.org>

	PR fortran/58007
	* module.c (MOD_VERSION): Bump.
	(fp2, find_pointer2): Remove.
	(mio_component_ref): Don't forcedfully set the containing derived type
	symbol for loading.
	(mio_symbol): Dump components earlier.
	(skip_list): New argument nest_level.  Initialize level with the new
	argument.
	(read_module): Add forced pointer components association for derived
	type symbols.
	
2014-01-02  Mikael Morin  <mikael@gcc.gnu.org>

	PR fortran/58007
	* gfortran.dg/unresolved_fixup_1.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr58007_v2.diff
Type: text/x-patch
Size: 5656 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140102/2aa47f1c/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unresolved_fixup_1.f90
Type: text/x-fortran
Size: 936 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140102/2aa47f1c/attachment-0001.bin>


More information about the Gcc-patches mailing list