https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105155
Bug ID: 105155 Summary: -fsanitize=signed-integer-overflow failed to check an overflow Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: shaohua.li at inf dot ethz.ch 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 Target Milestone: --- For the following code, I was expecting the sanitizer to warn about the integer overflow. I checked with clang's UBSAN, which would warn however. $cat a.c #include<limits.h> int foo(int a) { return INT_MAX + (a>0?1:-1); } int main() { __builtin_printf("%d\n", foo(1)); } $ $gcc -fsanitize=signed-integer-overflow -w -O0 a.c;./a.out -2147483648 $