http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49076

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-05-20 
21:50:25 UTC ---
If one places a break point in gfc_conv_array_parameter - which is called
during gfc_conv_procedure_call, one finds that "foo" is of type "AS_DEFERRED"
and not "AS_ASSUMED_SHAPE"; at the same time, it is not attr.allocatable, thus,
it is mishandled as one then enters:

  /* Passing address of the array if it is not pointer or assumed-shape.  */
  if (full_array_var && g77 && !this_array_result)
      [...]
      if (!sym->attr.pointer
            && sym->as
            && sym->as->type != AS_ASSUMED_SHAPE
            && !sym->attr.allocatable)
        {
          [...]
          else
            se->expr = gfc_build_addr_expr (NULL_TREE, tmp);

I think one could simply mark it as AS_ASSUMED_SHAPE to get it properly
handled, even though usually only dummies are assumed-shape. Thus, one might
need to be a bit careful.

Alternatively, one could change the expr->ref from AR_FULL to AR_SECTION, but
that might be also tricky to get right.

Reply via email to