https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115765
Bug ID: 115765
Summary: [13 Regression] signed integer overflow check missing
Product: gcc
Version: 13.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: sanitizer
Assignee: unassigned at gcc dot gnu.org
Reporter: bic60176 at gmail dot com
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
Target Milestone: ---
Created attachment 58577
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58577&action=edit
testcase
OS: Ubuntu 22.04.3 LTS
We found a case that UBSAN failed to report signed integer overflow behavior
when compiling with gcc-13.2.0, gcc-12.3.0, gcc-11.4.0 at optimization levels
-O0.
$ ../compiler-builds/gcc-13.2.0_build/bin/gcc -fsanitize=undefined
-fsanitize=address -g -lgcc_s -I/home/csmith/include/csmith-2.3.0 -O0
testcase.c -o exec
$ timeout 1s ./exec 2>exec.err
$ cat exec.err
$ ../compiler-builds/gcc-14.1.0_build/bin/gcc -fsanitize=undefined
-fsanitize=address -g -lgcc_s -I/home/csmith/include/csmith-2.3.0 -O1
testcase.c -o exec
$ timeout 1s ./exec 2>exec.err
$ cat exec.err
testcase.c:6:24: runtime error: signed integer overflow: 65533 * 67286 cannot
be represented in type 'int'