https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108995

            Bug ID: 108995
           Summary: Missed signed integer overflow checks in UBsan?
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: qrzhang at gatech dot edu
                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: ---

$ cat abc.c
int printf(const char *, ...);
int a;
const int b = 44514;
int *c = &a;
void main(void) {
  *c = 65526 * b / 6;
  printf("%d\n", a);
}

Ubsan did not emit any message. However, the outputs are different.

$ gcc-trunk -O3 -fsanitize=undefined abc.c ; ./a.out
-229690488

$ gcc-trunk  -fsanitize=undefined abc.c ; ./a.out
486137394

Reply via email to