https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120982
Bug ID: 120982
Summary: Incorrect alignment after 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
Target Milestone: ---
The vectorizer introduces incorrect alignment for the function below when
compiled for AArch64 with "-O3 -march=armv9.5-a -fno-strict-aliasing".
long a[1000];
int foo (int n)
{
for (int i = 0; i < n; i++)
if (a[i] == 0)
return 1;
return 0;
}
The vectorized memory accesses look like
vect__1.10_30 = MEM <vector(2) long int> [(long int *)vectp_a.8_28];
vectp_a.8_31 = vectp_a.8_28 + 16;
vect__1.11_32 = MEM <vector(2) long int> [(long int *)vectp_a.8_31];
where get_object_alignment returns that both have 32-byte alignment.