[patch,fortran] Allow "IMPORT :: list-of-symbols" in interface bodys in modules (PR27546)

Jerry DeLisle jvdelisle@verizon.net
Fri Dec 8 06:44:00 GMT 2006


Tobias Burnus wrote:
> * Ping *
> 
> Tobias Burnus wrote on November 28, 2006:
> 
>> 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.
>>   

This is OK.



More information about the Fortran mailing list