https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126417
Bug ID: 126417
Summary: Incorrect floating-point re-association
Product: gcc
Version: 17.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 following function is miscompiled for x86_64 with -O2:
float
g(float *v)
{
return v[0]+v[1]+v[2]+v[3];
}
The slp2 pass vectorizes the code, changing the calculation order to:
(v[0] + v[2]) + (v[1] + v[3])
This is not permitted unless -fassociative-math is enabled.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118443
[Bug 118443] [Meta bug] Bugs triggered by and blocking more smtgcc testing