https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101521
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Hans-Peter Nilsson from comment #5) > (In reply to Andrew Pinski from comment #0) > > As mentioned a few times -ftrapv is broken in many cases it would be better > > if it become something like -fsanitize=undefined > > -fsanitize-undefined-trap-on-error. > > Wouldn't that require sanitizer support for the target? In the case of `-fsanitize-undefined-trap-on-error` does not require any sanitizer support as what was a sanitizer call just becomes a __builtin_trap call. It does require the target to have support for the trap optab or the support for the abort call but I think that is currently supported for all targets right now. The trap optab would definitely improve things if not already supported on the target too.