https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103209
--- Comment #3 from Jan Hubicka <hubicka at gcc dot gnu.org> --- This is bug I introduced to tree-ssa-structalias where I reversed order of flags which deterine global memory read and writes. So pure functions are handled as functions writting global memory but not reading it. I am very surprised it took so long to show as wrong code. diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 153ddf57a61..34fd47fdf47 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -4996,7 +4996,7 @@ find_func_aliases_for_call (struct function *fn, gcall *t) reachable from their arguments, but they are not an escape point for reachable memory of their arguments. */ else if (flags & (ECF_PURE|ECF_LOOPING_CONST_OR_PURE)) - handle_rhs_call (t, &rhsc, implicit_pure_eaf_flags, true, false); + handle_rhs_call (t, &rhsc, implicit_pure_eaf_flags, false, true); /* If the call is to a replaceable operator delete and results from a delete expression as opposed to a direct call to such operator, then the effects for PTA (in particular