https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124526
Bug ID: 124526
Summary: New signed overflow introduced by linterchange
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: kristerw at gcc dot gnu.org
Blocks: 118443
Target Milestone: ---
linterchange introduces new signed overflows when the function below is
compiled for x86_64 with -O3:
int in[8][4];
int out[4];
void
foo (void)
{
int sum = 1;
int i, j, k;
for (k = 0; k < 4; k++)
{
for (j = 0; j < 4; j++)
#pragma GCC unroll 0
for (i = 0; i < 4; i++)
sum *= in[i + k][j];
out[k] = sum;
}
}
linterchange changes the order of the multiplications, and the result may now
overflow in cases where the original did not. For example, if in[1][0] has the
value 0 and the rest of the elements have the value 0x7fffffff.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118443
[Bug 118443] [Meta bug] Bugs triggered by and blocking more smtgcc testing