https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102515
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #5) > Created attachment 51529 [details] > gcc12-pr102515.patch > > I have one too, even bootstrapped/regtested overnight, just didn't get to > writing new testcases that would cover the cases that need testing (i.e. that > -f{,no-}sanitize-recover=float-divide-by-zero rather than > -f{,no-}sanitize-recover=integer-divide-by-zero decides on *_abort for float > division and the behavior for -fsanitize=undefined > -fno-sanitize-recover=integer-divide-by-zero or -fsanitize=undefined > -fno-sanitize-recover=signed-integer-overflow (i.e. when > integer-divide-by-zero and signed-integer-overflow differ in the recover > method). OK, so yours looks mostly identical to mine, even handling one minor case better and erring on the side to not preserve divide overflow with divide-by-zero (which I think is reasonable). I've yet only added c-c++-common/ubsan/overflow-div-1.c as /* { dg-do run } */ /* { dg-options "-fsanitize=signed-integer-overflow" } */ /* { dg-shouldfail "ubsan" } */ int __attribute__((noipa)) foo (int a, int b) { return a / b; } int main () { return foo (-__INT_MAX__ - 1, -1); } /* { dg-output "cannot be represented" } */ and did not add testcases for the fixed float-divide recovery (which I also noticed and fixed). Note I simply track whether _all_ of the used instrumentations have recovery enabled and if not then go the abort path.