[Patch, fortran] PR30554 - [4.2 and 4.1 only] ICE in mio_pointer_ref at module.c:1945

Paul Thomas paulthomas2@wanadoo.fr
Fri Feb 9 12:16:00 GMT 2007


:ADDPATCH fortran:

In principle, this PR was fixed, hence the restriction in the title.  In 
practice, the title is a lie because the real problem emerged after the 
patch was committed :-)

Crucially, although there was a bug that was fixed by the previous 
patch,  making all the symbols PRIVATE in the module CONSTRAINT, except 
the subroutine ENERGY_CONSTRAINT, exposed another bug.

When CONSTRAINT was used, success depended on the order in which it and 
ATOMS were referenced. If ATOMS followed CONSTRAINT, the symbol for 
NFREE was picked up and the symtree from ATOMS pointed to it.  This 
provided a symtree for the mio_symbol_ref that caused the ICE.

With the modules used in the opposite order, the pointer_info for the 
NFREE referenced from the specification expression never gets a symtree 
and so the ICE ensues.

Setting info->u.rsym.referenced inhibits the unique symtree mechanism 
and prevents read_cleanup from providing the symtree needed to reference 
the symbol NFREE.  Removing this line, is sufficient by itself to fix 
the bug and to regtest without problems.

The fix that I propose makes the setting of info->u.rsym.referenced 
conditional on the presence of a suitable symtree, pointing to the 
previously loaded symbol.  This symtree is pointed to by the new 
pointer_info.  If the module being read includes a symtree, this fix-up 
reference is correctly over-written.  On the other hand, if no symtree 
is found, read_cleanup generates one.

Now, the pointer_info has a symtree in all circumstances so the symbol 
references to NFREE always have a symtree to point to.

The only advantage of this more complicated fix is to reduce the number 
of unique symtrees being produced.  It will be at the expense of 
slightly more compilation time.  If it is felt that the one line fix 
(ie. removing the setting of rsym.referenced) is sufficient, I will be 
perfectly happy to commit that.

The testcase is incorporated in the previous one by adding the 
privatized versions of the modules.

I have added the legalization of actual_intrinsic_2.f90 to the patch.

Bootstrapped and regtested on Cygwin_NT/amd64 - OK for trunk and, after 
a delay of a week and in combination with the previous patch, 4.2?

I will check the patch with tonto and others before commiting.

Paul
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Change_new.Logs
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070209/63efde3e/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr30554_new.diff
Type: text/x-patch
Size: 5099 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070209/63efde3e/attachment.bin>


More information about the Fortran mailing list