https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124527
Bug ID: 124527
Summary: New signed overflow introduced by vectorization
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: ---
The vectorizer introduces new signed overflows when the function below is
compiled for x86_64 with -O3:
#define N 64
signed short X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
signed int Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
int
foo (int len)
{
int i;
int result = 0;
for (i = 0; i < len; i++)
{
result += (X[i] * Y[i]);
}
return result;
}
The vectorized code performs the additions in a different order, which may
cause overflow in cases where the original code did not overflow.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118443
[Bug 118443] [Meta bug] Bugs triggered by and blocking more smtgcc testing