[Patch, Fortran, OOP] PR 46581: [4.6 Regression] segfault in SELECT TYPE with associate-name

Janus Weil janus@gcc.gnu.org
Sun Nov 21 20:01:00 GMT 2010


Hi all,

here is a patch fixing a regression reported by Salvatore. It was
triggered by my recent renaming of the SELECT TYPE temporaries
(http://gcc.gnu.org/viewcvs?view=revision&revision=166480), which
uncovered a latent bug in the implementation of SELECT TYPE with
associate-name (http://gcc.gnu.org/viewcvs?view=revision&revision=163572).

Currently the initialization assignments for associate-names are
generated by 'gfc_trans_deferred_vars'. SELECT TYPE temporaries (we
need one for each TYPE IS/CLASS IS block) are also treated like
associate-names, but they reside in the wrong namespace (since they're
already generated at parsing stage where the local BLOCK namespaces
have not been set up), which is the reason for the error.

With the patch the initialization assignments are generated directly
in gfc_trans_block_construct (via the "ext.block.assoc" list), which
avoids the namespace problem.

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

Cheers,
Janus


2010-11-21  Janus Weil  <janus@gcc.gnu.org>

	* trans-decl.c (trans_associate_var): Moved to trans-stmt.c.
	(gfc_trans_deferred_vars): Skip ASSOCIATE variables.
	(gfc_process_block_locals): Don't mark associate names to be
	initialized.
	* trans-stmt.c (trans_associate_var): Moved here from trans-decl.c.
	(gfc_trans_block_construct): Call 'trans_associate_var' from here
	to make sure SELECT TYPE with associate-name is treated correctly.

2010-11-21  Janus Weil  <janus@gcc.gnu.org>

	* gfortran.dg/select_type_19.f03: New.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr46581.diff
Type: application/octet-stream
Size: 7175 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20101121/b2af3967/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: select_type_19.f03
Type: application/octet-stream
Size: 381 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20101121/b2af3967/attachment-0001.obj>


More information about the Gcc-patches mailing list