https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97836
Jan Hubicka <hubicka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |hubicka at gcc dot gnu.org --- Comment #3 from Jan Hubicka <hubicka at gcc dot gnu.org> --- Confirmed. The wrong code happens already in fre1 where we do: main () { int f; int * _1; <bb 2> : _1 = d (&f); __builtin_abort (); } Modref summary for d is: loads: Limits: 32 bases, 16 refs Base 0: alias set 1 Ref 0: alias set 1 Every access stores: Limits: 32 bases, 16 refs Base 0: alias set 1 Ref 0: alias set 1 Every access parm 0 flags: direct noclobber noescape unused for body: d (int * e) { int D.1973; int a.0_1; <bb 2> : a.0_1 = a; if (a.0_1 != 0) goto <bb 3>; [INV] else goto <bb 4>; [INV] <bb 3> : a = 0; <bb 4> : return e_10(D); } direct noclobber noescape looks correct to me: value is only returned and noescape values are allowed to escape to return value (per IRC discussion we had with Richi). I think problem is with unused that makes tree-ssa-structalias to completely skip the parameter rather than adding it to return value alias set. I guess we want to specify what unused really means. Indeed current comment is "Nonzero if the argument is not used by the function." and in this case we wold need to have separate EAF_NOREAD so current EAF_UNUSED would be EAF_NOCLOBBER | EAF_NOREAD or track that internally in ipa-modref. A quick fix is to make return statement clear EAF_UNUSED flag.