[Patch, fortran] PR34975 - [4.3 Regression] Bogus error with USEing modules

Paul Richard Thomas paul.richard.thomas@gmail.com
Tue Jan 29 01:24:00 GMT 2008


:ADDPATCH fortran:

This fix is relatively straight forward.  It does not touch the basic
mechanism for coping with USE associated symbols that are renamed,
having been previously been USE associated without renaming, and vice
versa.  Instead, it deals with an error (mine) in making symbols
unreachable:

Previously, I had prepended the symtree name with "hidden.".  I was
surprised that this worked but noting that I tried did damage to it.
In fact the extreme difficulty that Tobias and I had in reducing the
testcase is an indication that the original implementation was not too
bad.  Apparently a very rich symtree is needed to trigger the fault.

Instead of prepending, I have deleted the symtree, both in read_module
and in load_generic_interfaces.  This required that symbol.c (delete
interface) be renamed and made available in module.c.  Note that
handling is different in the two cases.  Since, in read_module, the
rsym is identical to the symbol, whose symtree is deleted, nothing is
left dangling and the symbol is recycled.  In load_generic_interfaces
the symbol must be picked up with a unique_symtree.

In fact, I was completely unable to reduce the testcase below that
achieved by Tobias - fortunately it is compile only, so I think that
it can stand.  Note that the number of errors changes between the
version with a makefile and that in the testcase, which includes the
modules!!

Bootstrapped and regtested on x86_ia64/FC8 - OK for trunk?

Paul

2008-01-29  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/34975
	* symbol.c (gfc_delete_symtree, gfc_undo_symbols): Rename
	delete_symtree to gfc_delete_symtree.
	* gfortran.h : Add prototype for gfc_delete_symtree.
	* module.c (load_generic_interfaces): Transfer symbol to a
	unique symtree and delete old symtree, instead of renaming.
	(read_module): The rsym and the found symbol are the same, so
	the found symtree can be deleted.

2008-01-29  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/34975
	* gfortran.dg/use_only_3.f90: New test.
	* gfortran.dg/use_only_3.inc: Modules for new test.


-- 
The knack of flying is learning how to throw yourself at the ground and miss.
       --Hitchhikers Guide to the Galaxy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: submit.diff
Type: text/x-patch
Size: 48207 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080129/b0107854/attachment.bin>


More information about the Fortran mailing list