https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119321
Bug ID: 119321
Summary: Jump threading causing false positive warnings with
integer ranges
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: peter0x44 at disroot dot org
Target Milestone: ---
the following testcase:
https://gcc.godbolt.org/z/766zxEfKn
int* p;
void f(int x)
{
for (int i = 0; i < x; i++) {
*p = 0;
}
p = __builtin_malloc(x);
for (int i = 0; i < x; i++) {
*p = 0;
}
}
when compiled with gcc -Wall -O1
produces a "bogus"/undesired warning with incorrect ranges for the call to
malloc:
<source>:8:9: warning: argument 1 range [18446744071562067968,
18446744073709551615] exceeds maximum object size 9223372036854775807
[-Walloc-size-larger-than=]
8 | p = __builtin_malloc(x);
| ^~~~~~~~~~~~~~~~~~~
adding `-fno-thread-jumps` removes this warning.