[patch,fortran] Allow "IMPORT :: list-of-symbols" in interface bodys in modules (PR27546)
Tobias Burnus
burnus@net-b.de
Tue Nov 28 14:43:00 GMT 2006
:ADDPATCH fortran:
Now with a proper patch.
Tobias Burnus wrote on November 20, 2006:
> there are two kinds of imports possible:
>
> First, "IMPORT" which imports all symbols and is done by essentially by
> doing:
> if( IS_INTERFACE && !current_namelist->has_import_set)
>
(This works flawlessly in the trunk.)
> Secondly, "IMPORT :: list-of-symbols". I currently do in decl.c's
> gfc_match_import:
>
> gfc_find_symbol (name, gfc_current_ns->parent, 1, &sym)
> st = gfc_new_symtree (&gfc_current_ns->sym_root, name);
> st->n.sym = sym;
> sym->refs++;
> sym->ns = gfc_current_ns;
>
> This works ok for programs, but fails for modules in trans-decl.c's
> gfc_create_module_variable:
> /* Only output symbols from this module. */
> if (sym->ns != module_namespace)
> /* I don't think this should ever happen. */
> internal_error ("module symbol %s in wrong namespace", sym->name);
>
> If I comment that condition, it seems to work without any problems, but
> I'm not sure I do the right thing(TM).
>
The patch now exactly does so. Ok for the trunk? Or should this handled
differently?
Tobias
fortran/
2006-11-28 Tobias Burnus <burnus@net-b.de>
PR fortran/27546
* trans-decl.f90 (gfc_create_module_variable): Allow imported symbols
in interface bodys in modules.
testsuite/
2006-11-28 Tobias Burnus <burnus@net-b.de>
PR fortran/27546
* gfortran.dg/import4.f90: New test for IMPORT in modules.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: import-fix2.diff
Type: text/x-patch
Size: 2765 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20061128/704267ca/attachment.bin>
More information about the Gcc-patches
mailing list