public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111652] New: wrong code at -O3 on x86_64-linux-gnu
@ 2023-10-01 11:59 zhendong.su at inf dot ethz.ch
  2023-10-01 16:18 ` [Bug tree-optimization/111652] [14 Regression] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2023-10-01 11:59 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111652
           Summary: wrong code at -O3 on x86_64-linux-gnu
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

It appears to be a recent regression.

Compiler Explorer: https://godbolt.org/z/89h8W1Pvs

[505] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/home/suz/suz-local/software/local/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231001 (experimental) (GCC) 
[506] % 
[506] % gcctk -O2 small.c; ./a.out
[507] % 
[507] % gcctk -O3 small.c
[508] % ./a.out
Aborted
[509] % 
[509] % cat small.c
volatile int a;
int b;
int main() {
  for (; b < 5; b += 3) {
    b && a;
    if (b < 4)
      a--;
  }
  if (b != 6)
    __builtin_abort();
  return 0;
}

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

* [Bug tree-optimization/111652] [14 Regression] wrong code at -O3 on x86_64-linux-gnu
  2023-10-01 11:59 [Bug tree-optimization/111652] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
@ 2023-10-01 16:18 ` pinskia at gcc dot gnu.org
  2023-10-01 16:32 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-01 16:18 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
           Keywords|                            |wrong-code
            Summary|wrong code at -O3 on        |[14 Regression] wrong code
                   |x86_64-linux-gnu            |at -O3 on x86_64-linux-gnu

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

* [Bug tree-optimization/111652] [14 Regression] wrong code at -O3 on x86_64-linux-gnu
  2023-10-01 11:59 [Bug tree-optimization/111652] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
  2023-10-01 16:18 ` [Bug tree-optimization/111652] [14 Regression] " pinskia at gcc dot gnu.org
@ 2023-10-01 16:32 ` pinskia at gcc dot gnu.org
  2023-10-02 17:58 ` tkoenig at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-01 16:32 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |needs-bisection
   Last reconfirmed|                            |2023-10-01
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

The first difference between GCC 13 and the trunk's IR is in lsplit.
I have not looked if that is causing the issue here or not.

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

* [Bug tree-optimization/111652] [14 Regression] wrong code at -O3 on x86_64-linux-gnu
  2023-10-01 11:59 [Bug tree-optimization/111652] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
  2023-10-01 16:18 ` [Bug tree-optimization/111652] [14 Regression] " pinskia at gcc dot gnu.org
  2023-10-01 16:32 ` pinskia at gcc dot gnu.org
@ 2023-10-02 17:58 ` tkoenig at gcc dot gnu.org
  2023-10-02 19:51 ` ppalka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2023-10-02 17:58 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |carll at gcc dot gnu.org

--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
I ran git bisect on POWER (gcc120) and strangely got this as the
first bad commit:

b51795c832cf6e724d61919eb18a383223b76694 is the first bad commit
commit b51795c832cf6e724d61919eb18a383223b76694
Author: Carl Love <cel@us.ibm.com>
Date:   Wed Jul 26 11:31:53 2023 -0400

    rs6000, fix vec_replace_unaligned built-in arguments

    The first argument of the vec_replace_unaligned built-in should always be
    of type vector unsigned char, as specified in gcc/doc/extend.texi.

    This patch fixes the builtin definitions and updates the test cases to use
    the correct arguments.  The original test file is renamed and a second test
    file is added for a new test case.

This is weird because the problem also occurs on x86_64.

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

* [Bug tree-optimization/111652] [14 Regression] wrong code at -O3 on x86_64-linux-gnu
  2023-10-01 11:59 [Bug tree-optimization/111652] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
                   ` (2 preceding siblings ...)
  2023-10-02 17:58 ` tkoenig at gcc dot gnu.org
@ 2023-10-02 19:51 ` ppalka at gcc dot gnu.org
  2023-10-02 20:29 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-10-02 19:51 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org
           Keywords|needs-bisection             |

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
On x86_64 this seems to have started with r14-2852-gf5fb9ff2396fd4

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

* [Bug tree-optimization/111652] [14 Regression] wrong code at -O3 on x86_64-linux-gnu
  2023-10-01 11:59 [Bug tree-optimization/111652] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
                   ` (3 preceding siblings ...)
  2023-10-02 19:51 ` ppalka at gcc dot gnu.org
@ 2023-10-02 20:29 ` pinskia at gcc dot gnu.org
  2023-10-04  9:26 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-02 20:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #3)
> On x86_64 this seems to have started with r14-2852-gf5fb9ff2396fd4

I was expecting it was one of the loop splitting patches due to the ir changes
I saw

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

* [Bug tree-optimization/111652] [14 Regression] wrong code at -O3 on x86_64-linux-gnu
  2023-10-01 11:59 [Bug tree-optimization/111652] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
                   ` (4 preceding siblings ...)
  2023-10-02 20:29 ` pinskia at gcc dot gnu.org
@ 2023-10-04  9:26 ` rguenth at gcc dot gnu.org
  2023-11-14 14:13 ` [Bug tree-optimization/111652] [14 Regression] wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396fd4 cvs-commit at gcc dot gnu.org
  2023-11-14 14:16 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-10-04  9:26 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |14.0
           Priority|P3                          |P1

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

* [Bug tree-optimization/111652] [14 Regression] wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396fd4
  2023-10-01 11:59 [Bug tree-optimization/111652] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
                   ` (5 preceding siblings ...)
  2023-10-04  9:26 ` rguenth at gcc dot gnu.org
@ 2023-11-14 14:13 ` cvs-commit at gcc dot gnu.org
  2023-11-14 14:16 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-14 14:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:2066c29bf8dea87c9810eb261e342d941a6b2059

commit r14-5446-g2066c29bf8dea87c9810eb261e342d941a6b2059
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Nov 14 14:26:17 2023 +0100

    tree-optimization/111233 - loop splitting miscompile

    The change in r14-2852-gf5fb9ff2396fd4 failed to update patch_loop_exit
    to compensate for rewriting of a NE/EQ_EXPR to a new code.  Fixed
    with the following.

            PR tree-optimization/111233
            PR tree-optimization/111652
            PR tree-optimization/111727
            PR tree-optimization/111838
            PR tree-optimization/112113
            * tree-ssa-loop-split.cc (patch_loop_exit): Get the new
            guard code instead of the old guard stmt.
            (split_loop): Adjust.

            * gcc.dg/torture/pr111233.c: New testcase.
            * gcc.dg/torture/pr111652.c: Likewise.
            * gcc.dg/torture/pr111727.c: Likewise.
            * gcc.dg/torture/pr111838.c: Likewise.
            * gcc.dg/torture/pr112113.c: Likewise.

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

* [Bug tree-optimization/111652] [14 Regression] wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396fd4
  2023-10-01 11:59 [Bug tree-optimization/111652] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
                   ` (6 preceding siblings ...)
  2023-11-14 14:13 ` [Bug tree-optimization/111652] [14 Regression] wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396fd4 cvs-commit at gcc dot gnu.org
@ 2023-11-14 14:16 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-11-14 14:16 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2023-11-14 14:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-01 11:59 [Bug tree-optimization/111652] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
2023-10-01 16:18 ` [Bug tree-optimization/111652] [14 Regression] " pinskia at gcc dot gnu.org
2023-10-01 16:32 ` pinskia at gcc dot gnu.org
2023-10-02 17:58 ` tkoenig at gcc dot gnu.org
2023-10-02 19:51 ` ppalka at gcc dot gnu.org
2023-10-02 20:29 ` pinskia at gcc dot gnu.org
2023-10-04  9:26 ` rguenth at gcc dot gnu.org
2023-11-14 14:13 ` [Bug tree-optimization/111652] [14 Regression] wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396fd4 cvs-commit at gcc dot gnu.org
2023-11-14 14:16 ` rguenth 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).