[Patch, fortran] PR32827 - IMPORT fails for TYPE when also used in INTERFACE

Paul Thomas paulthomas2@wanadoo.fr
Sun Aug 12 11:49:00 GMT 2007


:ADDPATCH fortran:

This problem comes about when a symbol is imported by name and then 
referred to in its own namespace.  This happens because the namespace of 
the imported symbol is changed to that of the interface.

The patch works by removing this change of interface and by adding an 
'imported' symbol attribute.  The check for an imported symbol is done 
by looking for the symtree in the interface namespace and testing for 
the imported attribute.  gfc_get_sym_tree has to be modified not to give 
an error on imported symbols.  The testcase is based on the reporter's.

Regtested on amd64/Cygwin_NT - OK for trunk?

Paul

2007-08-12  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/32827
    * decl.c (variable_decl): Check for an imported symbol
    by looking for its symtree and testing for the imported
    attribute.
    (gfc_match_import): Remove change of symbol's namespace
    and set the attribute imported instead.
    * symbol.c (gfc_get_sym_tree): It is not an error if a
    symbol is imported.
    * gfortran.h : Add the 'imported' to symbol_attribute.

2007-08-12  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/32827
    * gfortran.dg/import6.f90: New test.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr32827.diff
Type: text/x-patch
Size: 4685 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070812/e54ebc73/attachment.bin>


More information about the Fortran mailing list