http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47455
janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED AssignedTo|unassigned at gcc dot |janus at gcc dot gnu.org |gnu.org | --- Comment #8 from janus at gcc dot gnu.org 2011-01-31 22:00:30 UTC --- (In reply to comment #6) > (In reply to comment #3) > > RFC patch. Janus, what do you think? > > I think I'd prefer the following version: > > Index: gcc/fortran/trans-expr.c > =================================================================== > --- gcc/fortran/trans-expr.c (revision 169442) > +++ gcc/fortran/trans-expr.c (working copy) > @@ -3606,10 +3606,9 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * > x = f() > where f is pointer valued, we have to dereference the result. */ > if (!se->want_pointer && !byref > - && (sym->attr.pointer || sym->attr.allocatable) > - && !gfc_is_proc_ptr_comp (expr, NULL)) > - se->expr = build_fold_indirect_ref_loc (input_location, > - se->expr); > + && ((!comp && (sym->attr.pointer || sym->attr.allocatable)) > + || (comp && (comp->attr.pointer || comp->attr.allocatable)))) > + se->expr = build_fold_indirect_ref_loc (input_location, se->expr); > > /* f2c calling conventions require a scalar default real function to > return a double precision result. Convert this back to default > > > > This fixes all of the following variant of the test case It also regtests cleanly, and I'm pretty sure it's the proper thing to do. So I'll just go ahead and commit it ... (The test case in comment #5 currently aborts with this patch, though I'm not sure if that is correct behavior.)