public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "zhendong.su at inf dot ethz.ch" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/115661] wrong code at -O{2,3} on x86_64-linux-gnu
Date: Wed, 26 Jun 2024 10:14:44 +0000	[thread overview]
Message-ID: <bug-115661-4-nqTZf4WGIK@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-115661-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #1 from Zhendong Su <zhendong.su at inf dot ethz.ch> ---
The following might be the same or related although it needs several flags to
trigger. 

Compiler Explorer: https://godbolt.org/z/Y9414PbTh

[567] % 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/15.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 15.0.0 20240626 (experimental) (GCC) 
[568] % 
[568] % gcctk -O2 small.c; ./a.out
[569] % 
[569] % gcctk -O2 -fno-tree-pre -fschedule-insns -fno-forward-propagate
-fno-guess-branch-probability -fno-gcse small.c
[570] % ./a.out
0
[571] % 
[571] % cat small.c
int printf(const char *, ...);
struct {
  unsigned : 8;
  volatile unsigned b : 1;
  int c : 31;
  int d : 5;
} g, k, m, n, p;
unsigned e = 5;
volatile int f = 1;
int h, i, l, o, r, q;
long j, a;
int main() {
  if (0)
  L:
    for (; e; e++)
      ;
  for (; j < 5; j = 0)
    if (f) {
      int t = 7 - (((k.d | 7) ^ m.c) - a) - ~(n.b & -o), u, v = -t ^ q,
          w = e - h;
      u = k.d;
      if (i) {
        if (w > 6)
          goto L;
        printf("%d", l);
      }
      g.d = (g.d & (n.b - 5)) - (-((k.d - 7 - o) & t) ^ (v & q));
      n.b = t;
      m.c = ~(t - (7L & m.c));
      k.d = ~(a & (m.c | ~o) & ~u) & g.d;
      if ((unsigned) p.d >= e)
        printf("0\n");
      return 0;
    }
  return 0;
}

  reply	other threads:[~2024-06-26 10:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-26 10:06 [Bug tree-optimization/115661] New: " zhendong.su at inf dot ethz.ch
2024-06-26 10:14 ` zhendong.su at inf dot ethz.ch [this message]
2024-06-26 10:35 ` [Bug tree-optimization/115661] [15 Regression] " rguenth at gcc dot gnu.org
2024-06-26 11:29 ` sjames at gcc dot gnu.org
2024-06-26 11:34 ` [Bug tree-optimization/115661] [15 Regression] wrong code at -O{2,3} on x86_64-linux-gnu since r15-1599-g63512c72df09b4 sjames at gcc dot gnu.org
2024-06-26 12:27 ` sjames at gcc dot gnu.org
2024-06-26 13:30 ` [Bug target/115661] " rguenth at gcc dot gnu.org
2024-06-26 18:43 ` Evgeny.Karpov at microsoft dot com
2024-06-26 23:45 ` sjames at gcc dot gnu.org
2024-06-27  5:00 ` sjames at gcc dot gnu.org
2024-06-27  7:24 ` Evgeny.Karpov at microsoft dot com
2024-06-28 12:47 ` cvs-commit at gcc dot gnu.org
2024-06-28 12:50 ` clyon at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-115661-4-nqTZf4WGIK@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).