[Bug fortran/49648] ICE(segfault) with MATMUL and function-result actual argument

mikael at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jul 6 17:28:00 GMT 2011


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

--- Comment #10 from Mikael Morin <mikael at gcc dot gnu.org> 2011-07-06 17:28:14 UTC ---
(In reply to comment #9)
> (In reply to comment #8)
> > +  else if (mp_flag && sym->attr.flavor == FL_PROCEDURE && sym->attr.function)
> > +    gfc_resolve_array_spec (sym->result->as, false);
> 
> I think one could add somewhere a condition "if (sym != sym->result)";
This is contained in mp_flag :-)

> and I was wondering whether also other items like length-type parameters are
> effected. (I think, usually character lengths are shared, but I am not sure
> whether it also happens here.)
Well, it's difficult to tell by quickly (or even slowly) browsing through the
function.
I was supposing resolve_symbol would handle all other items in my previous
patch, but it fails unfortunately (for reasons that I have admittedly not
investigated); hence this less ambitious one, which doesn't regress at least. 
For what it's worth the following variant using character lengths doesn't ICE.
I can't tell in the general case though.


module m2
  COMPLEX, SAVE, ALLOCATABLE :: P(:)
contains
  FUNCTION getPhaseMatrix() RESULT(PM)
    CHARACTER(len=SIZE(P)) :: PM
    PM="foo   "
  END FUNCTION
end module m2

module m
  use m2
contains
   SUBROUTINE gf_generateEmbPot()
      CHARACTER(3) :: sigma2
      sigma2 = TRIM(getPhaseMatrix())
   END SUBROUTINE
end module m



More information about the Gcc-bugs mailing list