[Bug tree-optimization/92765] [10 Regression] Wrong code caused by folding of -Wstring-compare since r276773

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Dec 17 12:57:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92765

--- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
As for __builtin_*_eq, we could have some analysis that looks at accesses from
the same base, and e.g. if there is struct S { char name[16]; int whatever; }
and
we see strcmp (p->name, ...) and p->whatever stored or loaded before that or
after that with no possibility to exit/abort etc. in between, we could still
optimize into *_eq.  Doesn't tree-if-conv.c have similar analysis (ifc_dr
etc.)?
Maybe it would need to know minimal page size and only trigger if the
read/write of a field after it isn't too far away as a guarantee that in a
valid program if the first byte of p->name doesn't trap, then others won't
either.


More information about the Gcc-bugs mailing list