https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115278
Bug ID: 115278
Summary: -ftree-vectorize optimizes away volatile write on
x86_64
Product: gcc
Version: 14.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: raffeck at cs dot fau.de
Target Milestone: ---
Created attachment 58308
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58308&action=edit
minimal example to reproduce bug
The code in the attached minimal example contains two volatile writes to the
same address.
With `gcc -O2 -fno-tree-loop-vectorize`, two writes are present in the
generated object code. With just `gcc -O2` however, only one write is
preserved, the other seems to be optimized away. As these are volatile
accesses, this should be an illegal optimization.
The behavior does not occur with commit 498ad738690, but occurs with
25413fdb2ac, so probably 25413fdb2ac introduced this bug. The behavior still
persists in the current master (commit f46eaad445e).