[Bug sanitizer/112748] memmove(ptr, ptr, n) call optimized out even at -O0 with -fsanitize=undefined
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Nov 29 06:53:04 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112748
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Keywords| |documentation
CC| |dodji at gcc dot gnu.org,
| |dvyukov at gcc dot gnu.org,
| |jakub at gcc dot gnu.org,
| |kcc at gcc dot gnu.org,
| |marxin at gcc dot gnu.org
Ever confirmed|0 |1
Component|middle-end |sanitizer
Last reconfirmed| |2023-11-29
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed. We fold all calls early after gimplification and folding is known
to also affect -O0. This behavior is independent of sanitizing which happens
partly before and partly only after this folding takes place.
We also simplify 1 + 1 or x + 0 with -O0 or turn printf("%s", "Hello")
into puts("Hello") for example.
Documenting this behavior might be good. Gating some of the simplifications
on optimization might be also reasonable.
More information about the Gcc-bugs
mailing list