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 46581: [4.6 Regression] segfault in SELECT TYPE with associate-name


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.

Attachment: pr46581.diff
Description: Binary data

Attachment: select_type_19.f03
Description: Binary data


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