http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48588
--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-04-18
18:41:18 UTC ---
The problem is that when one goes via:
gfc_get_extern_function_decl -> gfc_get_function_type
one has for the "a" argument of DGESV_F90 in gfc_sym_type the value:
sym->as->type == AS_DEFERRED
However, the variable is not a pointer/deferred and thus gfc_is_nodesc_array
returns that "a" is a descriptorless array ("return sym->as->type !=
AS_ASSUMED_SHAPE"), which is wrong.
The question is: Why is "a" AS_DEFERRED and not AS_ASSUMED_SHAPE?
* * *
In principle, the changing of the "sym->as->type" to "AS_ASSUMED_SHAPE" is done
in resolve.c's resolve_formal_arglist. If one sets a break point there, one
sees that the function is called twice for "dgesv_f90" - but both times with
proc->attr.if_source == IFSRC_IFBODY, once with proc->attr.use_assoc being 0
and once with it being 1.
If one has -fno-whole-file, resolve_formal_arglist is also called for
"dgesv_f90" itself (IFSRC_DECL) - and thus as->type is correctly set. That's
called via resolve_contained_functions
* * *
My impression is that the resolving issues are an ordering problem in parse.c's
gfc_parse_file. If one looks at the code, one finds:
loop:
st = next_statement ();
switch (st)
{
case ST_SUBROUTINE:
if (gfc_option.flag_whole_file)
goto prog_units;
break;
case ST_MODULE:
break;
}
gfc_resolve (gfc_current_ns);
if (s.state == COMP_MODULE)
gfc_generate_module_code (gfc_current_ns);
goto loop;
prog_units:
gfc_global_ns_list = gfc_current_ns;
goto loop;
done:
resolve_all_program_units (gfc_global_ns_list);
translate_all_program_units (gfc_global_ns_list);