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

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

            Bug ID: 112113
           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/vaY9GEnrz


[549] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/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 20231028 (experimental) (GCC) 
[550] % 
[550] % gcctk -O2 small.c; ./a.out
[551] % 
[551] % gcctk -O3 small.c
small.c: In function ‘main’:
small.c:3:29: warning: iteration 1 invokes undefined behavior
[-Waggressive-loop-optimizations]
    3 |   for (int b = 0; b < 33; b += 3) {
      |                           ~~^~~~
small.c:3:21: note: within this loop
    3 |   for (int b = 0; b < 33; b += 3) {
      |                   ~~^~~~
[552] % ./a.out
Aborted
[553] % 
[553] % cat small.c
volatile int a;
int main() {
  for (int b = 0; b < 33; b += 3) {
    if (b > 31)
      a++;
  }
  if (a != 0)
    __builtin_abort();
  return 0;
}

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

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

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
            Version|unknown                     |14.0

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

* [Bug tree-optimization/112113] [14 Regression] wrong code at -O3 on x86_64-linux-gnu
  2023-10-28  6:11 [Bug tree-optimization/112113] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
  2023-10-28  6:16 ` [Bug tree-optimization/112113] [14 Regression] " pinskia at gcc dot gnu.org
@ 2023-10-28  6:17 ` pinskia at gcc dot gnu.org
  2023-10-28 22:06 ` tkoenig at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-28  6:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-10-28
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. -fno-split-loops  fixes it ...

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

* [Bug tree-optimization/112113] [14 Regression] wrong code at -O3 on x86_64-linux-gnu
  2023-10-28  6:11 [Bug tree-optimization/112113] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
  2023-10-28  6:16 ` [Bug tree-optimization/112113] [14 Regression] " pinskia at gcc dot gnu.org
  2023-10-28  6:17 ` pinskia at gcc dot gnu.org
@ 2023-10-28 22:06 ` tkoenig at gcc dot gnu.org
  2023-10-28 22:10 ` tkoenig at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2023-10-28 22:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
According to bisection, f5fb9ff2396fd41fdd2e6d35a412e936d2d42f75
is the first bad commit.

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

* [Bug tree-optimization/112113] [14 Regression] wrong code at -O3 on x86_64-linux-gnu
  2023-10-28  6:11 [Bug tree-optimization/112113] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
                   ` (2 preceding siblings ...)
  2023-10-28 22:06 ` tkoenig at gcc dot gnu.org
@ 2023-10-28 22:10 ` tkoenig at gcc dot gnu.org
  2023-10-29 22:48 ` [Bug tree-optimization/112113] [14 Regression] wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396fd4 pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2023-10-28 22:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to Thomas Koenig from comment #2)
> According to bisection, f5fb9ff2396fd41fdd2e6d35a412e936d2d42f75
> is the first bad commit.

Or, if anybody wants a link,
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=f5fb9ff2396fd41fdd2e6d35a412e936d2d42f75
.

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

* [Bug tree-optimization/112113] [14 Regression] wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396fd4
  2023-10-28  6:11 [Bug tree-optimization/112113] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
                   ` (3 preceding siblings ...)
  2023-10-28 22:10 ` tkoenig at gcc dot gnu.org
@ 2023-10-29 22:48 ` pinskia at gcc dot gnu.org
  2023-10-30 13:04 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-29 22:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=111652

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks almost the same code as what was in PR 111652 (maybe it is a dup after
all).

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

* [Bug tree-optimization/112113] [14 Regression] wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396fd4
  2023-10-28  6:11 [Bug tree-optimization/112113] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
                   ` (4 preceding siblings ...)
  2023-10-29 22:48 ` [Bug tree-optimization/112113] [14 Regression] wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396fd4 pinskia at gcc dot gnu.org
@ 2023-10-30 13:04 ` rguenth at gcc dot gnu.org
  2023-11-14 13:19 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-10-30 13:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

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

* [Bug tree-optimization/112113] [14 Regression] wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396fd4
  2023-10-28  6:11 [Bug tree-optimization/112113] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
                   ` (5 preceding siblings ...)
  2023-10-30 13:04 ` rguenth at gcc dot gnu.org
@ 2023-11-14 13:19 ` 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
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-11-14 13:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
patch_loop_exit simply copies the original guard code rather than using the
analyzed one.  Testing a patch.

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

* [Bug tree-optimization/112113] [14 Regression] wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396fd4
  2023-10-28  6:11 [Bug tree-optimization/112113] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
                   ` (6 preceding siblings ...)
  2023-11-14 13:19 ` 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
  8 siblings, 0 replies; 10+ 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=112113

--- Comment #6 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] 10+ messages in thread

* [Bug tree-optimization/112113] [14 Regression] wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396fd4
  2023-10-28  6:11 [Bug tree-optimization/112113] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
                   ` (7 preceding siblings ...)
  2023-11-14 14:13 ` cvs-commit at gcc dot gnu.org
@ 2023-11-14 14:16 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ 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=112113

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

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

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

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

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

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-28  6:11 [Bug tree-optimization/112113] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
2023-10-28  6:16 ` [Bug tree-optimization/112113] [14 Regression] " pinskia at gcc dot gnu.org
2023-10-28  6:17 ` pinskia at gcc dot gnu.org
2023-10-28 22:06 ` tkoenig at gcc dot gnu.org
2023-10-28 22:10 ` tkoenig at gcc dot gnu.org
2023-10-29 22:48 ` [Bug tree-optimization/112113] [14 Regression] wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396fd4 pinskia at gcc dot gnu.org
2023-10-30 13:04 ` rguenth at gcc dot gnu.org
2023-11-14 13:19 ` 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

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).