public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115192] New: GCC 14.1.0 -O3 miscompilation on x86-64 (loops with vectors and scalars)
@ 2024-05-22 14:54 jukka.suomela at aalto dot fi
  2024-05-22 14:55 ` [Bug c++/115192] " jukka.suomela at aalto dot fi
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: jukka.suomela at aalto dot fi @ 2024-05-22 14:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115192
           Summary: GCC 14.1.0 -O3 miscompilation on x86-64 (loops with
                    vectors and scalars)
           Product: gcc
           Version: 14.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jukka.suomela at aalto dot fi
  Target Milestone: ---

Created attachment 58268
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58268&action=edit
Preprocessed source code

It seems that GCC 14.1.0 with -O3 mis-compiles the attached code on x86-64. The
key element seems to be loops that involve both arrays of vector types and
arrays of scalar types.

This is the expected output:

$ g++-14 -Wall -Wextra -O2 test.cc -o test && ./test
0.000000 0.000000
3.000000 3.000000
9.000000 9.000000

This is the unexpected output that we got with -O3:

$ g++-14 -Wall -Wextra -O3 test.cc -o test && ./test
0.000000 0.000000
3.000000 3.000000
6.000000 6.000000

I have attached the preprocessed source code produced by the following command,
and I will attach also the full compiler output that I got:

g++-14 -v -save-temps -Wall -Wextra -O3 test.cc -o test

Compiler: GNU C++17 (Homebrew GCC 14.1.0) version 14.1.0
(x86_64-apple-darwin21), compiled by GNU C version 14.1.0, GMP version 6.3.0,
MPFR version 4.2.1, MPC version 1.3.1, isl version isl-0.26-GMP, Target:
x86_64-apple-darwin21.6.0.

This is GCC on Intel-macOS from Homebrew, but we originally noticed the problem
in Intel-Linux, so it doesn't seem to be specific to macOS or Homebrew.
However, I wasn't able to reproduce the bug on Apple M3, so it might be
specific to x86-64.

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

end of thread, other threads:[~2024-06-04 12:48 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-22 14:54 [Bug c++/115192] New: GCC 14.1.0 -O3 miscompilation on x86-64 (loops with vectors and scalars) jukka.suomela at aalto dot fi
2024-05-22 14:55 ` [Bug c++/115192] " jukka.suomela at aalto dot fi
2024-05-22 15:29 ` [Bug c++/115192] [14/15 regression] " sjames at gcc dot gnu.org
2024-05-22 15:37 ` [Bug c++/115192] [14/15 regression] -O3 miscompilation on x86-64 (loops with vectors and scalars) since r14-2117 jakub at gcc dot gnu.org
2024-05-22 17:02 ` jukka.suomela at aalto dot fi
2024-05-22 17:12 ` jakub at gcc dot gnu.org
2024-05-22 17:36 ` [Bug c++/115192] [11/12/13/14/15 regression] -O3 miscompilation on x86-64 (loops with vectors and scalars) since r11-6380 sjames at gcc dot gnu.org
2024-05-23  7:05 ` rguenth at gcc dot gnu.org
2024-05-23  7:14 ` jakub at gcc dot gnu.org
2024-05-23  8:09 ` rguenth at gcc dot gnu.org
2024-05-23  8:10 ` rguenth at gcc dot gnu.org
2024-05-23  9:32 ` rsandifo at gcc dot gnu.org
2024-05-24 12:47 ` cvs-commit at gcc dot gnu.org
2024-05-24 12:48 ` [Bug c++/115192] [11/12/13/14 " rsandifo at gcc dot gnu.org
2024-05-31  7:23 ` cvs-commit at gcc dot gnu.org
2024-05-31 14:56 ` [Bug c++/115192] [11/12/13 " cvs-commit at gcc dot gnu.org
2024-06-04  7:47 ` [Bug c++/115192] [11/12 " cvs-commit at gcc dot gnu.org
2024-06-04 12:47 ` [Bug c++/115192] [11 " cvs-commit at gcc dot gnu.org
2024-06-04 12:48 ` rsandifo 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).