public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115018] New: Incorrect data read/written at -O3 on Arm with 256-bit SVE SIMD width specified
@ 2024-05-09 20:29 erik at kth dot se
  2024-05-09 21:05 ` [Bug target/115018] Incorrect data read/written at -O3 on aarch64 " pinskia at gcc dot gnu.org
  2024-05-09 21:11 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: erik at kth dot se @ 2024-05-09 20:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115018

            Bug ID: 115018
           Summary: Incorrect data read/written at -O3 on Arm with 256-bit
                    SVE SIMD width specified
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: erik at kth dot se
  Target Milestone: ---

Created attachment 58154
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58154&action=edit
Source code to reproduce the bug (only includes 3x std headers)

Hi GCC,

When testing Gromacs on Amazon's Graviton3 Arm nodes with SVE support using
Ubuntu 24.04 with gcc-13.2.0, I have been tracking down a strange failed unit
test that occurs in non-SVE code, but only when I manually specify 256-bit SVE
length (instead of auto).

This code had a ton of dependencies on Google test and other files, but I think
I have been able to isolated it to a small file that only includes vector and
array - see attachment.

The code in question creates a std::vector with 10 elements, where each element
is a std::array with 3 floats. Initially they are all set to zero, and then I
add (0,10,0) to all elements.

With this combination of high optimization and 256-bit SVE, only some of the
elements will be updated, while the other ones are still (0,0,0):


g++ -O3 -march=armv8.2-a+sve -msve-vector-bits=256 bug.cpp -Wall -Wextra
-fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations

If I remove either then -O3, or -msve-vector-bits=256, the results are fine.

The bug also disappears if I don't have this slightly-complex multi-level
inheritance, or if I use plain C arrays instead of std containers, or remove
any of the other seemingly stupid constructs in the attached example - but at
least I saved you from having to debug all of Google test :-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-09 21:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-09 20:29 [Bug c++/115018] New: Incorrect data read/written at -O3 on Arm with 256-bit SVE SIMD width specified erik at kth dot se
2024-05-09 21:05 ` [Bug target/115018] Incorrect data read/written at -O3 on aarch64 " pinskia at gcc dot gnu.org
2024-05-09 21:11 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).