https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82083
Bug ID: 82083 Summary: sanitizer detects signed integer overflow in tree-data-ref.c with -O3 Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: zeccav at gmail dot com Target Milestone: --- Host: x86_64-pc-linux-gnu Build: trunk 251201 // from test case pr60183.c // must be compiled with -O3 option // signed integer overflow in tree-data-ref.c int j = 2; void foo (unsigned long *x, unsigned char *y) { int i; unsigned long w = x[0]; for (i = 0; i < j; i++) { w += *y; y += 0x10000; w += *y; } x[1] = w; } /*../../gcc/gcc/tree-data-ref.c:3427:16: runtime error: signed integer overflow: 65536 * -65536 cannot be represented in type 'int' ../../gcc/gcc/tree-data-ref.c:3350:16: runtime error: signed integer overflow: 1073741824 + 1073741824 cannot be represented in type 'int' ../../gcc/gcc/tree-data-ref.c:3429:7: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself ../../gcc/gcc/tree-data-ref.c:3428:7: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself*/