[Bug sanitizer/113878] missed optimization with sanitizer and signed integer overflow

2024-02-12 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113878 --- Comment #9 from Richard Biener --- I'd very much appreciate getting rid of TYPE_OVERFLOW_SANITIZED checks by doing instrumentation in the frontends. Note we do #define TYPE_OVERFLOW_UNDEFINED(TYPE) \ (POINTER_TY

[Bug sanitizer/113878] missed optimization with sanitizer and signed integer overflow

2024-02-11 Thread uecker at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113878 --- Comment #8 from uecker at gcc dot gnu.org --- (In reply to Jakub Jelinek from comment #7) > (In reply to uecker from comment #6) > > My idea would be to explicitly add either traps or __builtin_unreachable > > whenever there is UB that can be

[Bug sanitizer/113878] missed optimization with sanitizer and signed integer overflow

2024-02-11 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113878 --- Comment #7 from Jakub Jelinek --- (In reply to uecker from comment #6) > My idea would be to explicitly add either traps or __builtin_unreachable > whenever there is UB that can be checked for in the C FE, and not add > sanitizer calls (that

[Bug sanitizer/113878] missed optimization with sanitizer and signed integer overflow

2024-02-11 Thread uecker at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113878 --- Comment #6 from uecker at gcc dot gnu.org --- My idea would be to explicitly add either traps or __builtin_unreachable whenever there is UB that can be checked for in the C FE, and not add sanitizer calls (that may return). Just a lightweigh

[Bug sanitizer/113878] missed optimization with sanitizer and signed integer overflow

2024-02-11 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113878 --- Comment #5 from Jakub Jelinek --- Different instrumentations are done at different times. Some ubsan instrumentations are already done in the FEs (e.g. shifts, division, ...), others are added in the ubsan pass (the idea is that catching up

[Bug sanitizer/113878] missed optimization with sanitizer and signed integer overflow

2024-02-11 Thread uecker at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113878 --- Comment #4 from uecker at gcc dot gnu.org --- Would it make sense to add the instrumentation earlier? Then it could be optimized as usual which may give better results. Just adding a test explicitly shows that this works: https://godbolt.

[Bug sanitizer/113878] missed optimization with sanitizer and signed integer overflow

2024-02-11 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113878 --- Comment #3 from Jakub Jelinek --- The sanitizers don't turn on -fwrapv. There is just TYPE_OVERFLOW_SANITIZED which inhibits various optimizations, in the constant folder and match.pd etc. so that stuff can be instrumented properly, doesn't

[Bug sanitizer/113878] missed optimization with sanitizer and signed integer overflow

2024-02-11 Thread uecker at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113878 uecker at gcc dot gnu.org changed: What|Removed |Added CC||uecker at gcc dot gnu.org --

[Bug sanitizer/113878] missed optimization with sanitizer and signed integer overflow

2024-02-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113878 Andrew Pinski changed: What|Removed |Added Component|middle-end |sanitizer CC|