[Bug tree-optimization/126417] New: Incorrect floating-point re-association

"kristerw at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.