https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117692
Bug ID: 117692
Summary: The VRP pass is introducing new signed integer
overflow
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: kristerw at gcc dot gnu.org
Target Milestone: ---
The VRP pass is introducing new signed integer overflow when compiling the
following function for X86_64 with -O3:
int
f4 (int x)
{
if (x & 7)
__builtin_unreachable ();
x /= 8;
x += 4;
return x * 200;
}
The original function does not invoke UB when called as f4(-85899368), but the
VRP pass is changing
x_3 = x_2(D) / 8;
x_4 = x_3 + 4;
_5 = x_4 * 200;
return _5;
to
_7 = x_2(D) * 25;
_5 = _7 + 800;
return _5;
which has a signed overflow for
_7 = x_2(D) * 25;