https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119312
--- Comment #9 from Bruno Haible <bruno at clisp dot org> ---
> But the callee is still allowed to assign the whole struct through the
> non-const pointer.
Oh, I see. Yes,
void
foo (struct S *s)
{
s[-1] = s[0];
}
would disable the optimization.
Yeah, then it needs IPA.
> in your testcase we'd need to know that strcmp doesn't escape the address
> (maybe we know that already, haven't checked).
We need only to see that the compilation unit only ever accesses html5[i].name
and html5[i].value but never html5[i] as an entire struct. I don't think any
knowledge about strcmp is needed.