[Patch, fortran] PR27269 and PR27324 - Module equivalences

Paul Thomas Paul.Thomas@jet.uk
Fri Apr 28 09:10:00 GMT 2006


:ADDPATCH fortran:

This patch fixes PR27269 which causes a segfault in trying to process 
module b of the testcase, with an unused equivalence from module a. In 
the course of developing the patch, PR27324 was uncovered, which 
produces an assembler error when module equivalences have a member with 
an initializer.

PR27269 requires modifications to module.c(load_equiv) to recognise that 
members of an equivalence group are not used.  This is detected by the 
absence of a symtree for the variable.  To reach this stage, the 
expression has been read and a fixup entry generated in mio_expr_ref.  
To prevent this latter from happening and to allow the expression to be 
freed in load_equiv, a flag in_load_equiv has been added.  To summarise, 
the equivalence is read as usual, except that the absence of a symtree 
does not produce a fixup entry. Subsequently, the absence of a symtree 
is used to trigger the deletion of the equivalence and the associated 
expressions.

PR27234 is fixed in trans_common.c by inverting the order of the calls 
to finish_equivalences and gfc_commit_symbols. This is necessary because 
module equivalences are represented in gfc_common_ns as symtree/symbol 
entries, like common blocks.  Without the call to gfc_commit_symbols, 
these symbols were being deleted because they were still marked as 
temporary.

Regtested on Cygwin_NT/Athlon_M

OK for trunk and 4.1?

Paul

2006-04-28 Paul Thomas <pault@gcc.gnu.org>

	PR fortran/27269
	* module.c: Add static flag in_load_equiv.
	(mio_expr_ref): Return if no symtree and in_load_equiv.
	(load_equiv): If any of the equivalence members have no symtree, free
	the equivalence and the associated expressions.

	PR fortran/27324
	* trans-common.c (gfc_trans_common): Invert the order of calls to
	finish equivalences and gfc_commit_symbols.


2006-04-28 Paul Thomas <pault@gcc.gnu.org>

	PR fortran/27269
	PR fortran/27324
	* gfortran.dg/module_equivalence_2.f90: New test.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: module_equivalence.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20060428/909f2421/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: module_equivalence_2.f90
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20060428/909f2421/attachment.f90>


More information about the Gcc-patches mailing list