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

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

            Bug ID: 111838
           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/Mx76x5h5K


[614] % 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 20231016 (experimental) (GCC) 
[615] % 
[615] % gcctk -O2 small.c; ./a.out
[616] % 
[616] % gcctk -O3 small.c; ./a.out
small.c: In function ‘main’:
small.c:6:17: warning: iteration 4 invokes undefined behavior
[-Waggressive-loop-optimizations]
    6 |       if (e ? a % e : 0)
      |               ~~^~~
small.c:5:26: note: within this loop
    5 |     for (char e = -17; e < 1; e += 5) {
      |                        ~~^~~
Floating point exception
[617] % 
[617] % cat small.c
int a, b, c;
volatile char d;
int main() {
  for (; b < 1; b++)
    for (char e = -17; e < 1; e += 5) {
      if (e ? a % e : 0)
        d;
      for (c = 0; c < 1; c++)
        ;
    }
  return 0;
}

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

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

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
            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] 7+ messages in thread

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

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

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

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The first IR difference comes in from lsplit ...

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

* [Bug tree-optimization/111838] [14 Regression] wrong code at -O3 on x86_64-linux-gnu
  2023-10-16 18:44 [Bug tree-optimization/111838] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
  2023-10-16 18:49 ` [Bug tree-optimization/111838] [14 Regression] " pinskia at gcc dot gnu.org
  2023-10-16 18:52 ` pinskia at gcc dot gnu.org
@ 2023-10-17  6:41 ` rguenth at gcc dot gnu.org
  2023-10-17 13:52 ` ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-10-17  6:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug tree-optimization/111838] [14 Regression] wrong code at -O3 on x86_64-linux-gnu
  2023-10-16 18:44 [Bug tree-optimization/111838] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
                   ` (2 preceding siblings ...)
  2023-10-17  6:41 ` rguenth at gcc dot gnu.org
@ 2023-10-17 13:52 ` ppalka at gcc dot gnu.org
  2023-11-14 14:13 ` [Bug tree-optimization/111838] [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
  5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-10-17 13:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
This one also started with r14-2852-gf5fb9ff2396fd4

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

* [Bug tree-optimization/111838] [14 Regression] wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396fd4
  2023-10-16 18:44 [Bug tree-optimization/111838] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
                   ` (3 preceding siblings ...)
  2023-10-17 13:52 ` ppalka 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
  5 siblings, 0 replies; 7+ 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=111838

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

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

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

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

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

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

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-16 18:44 [Bug tree-optimization/111838] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
2023-10-16 18:49 ` [Bug tree-optimization/111838] [14 Regression] " pinskia at gcc dot gnu.org
2023-10-16 18:52 ` pinskia at gcc dot gnu.org
2023-10-17  6:41 ` rguenth at gcc dot gnu.org
2023-10-17 13:52 ` ppalka at gcc dot gnu.org
2023-11-14 14:13 ` [Bug tree-optimization/111838] [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).