public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "shaohua.li at inf dot ethz.ch" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/111444] New: Wrong code at -O2/3/s on x86_64-gnu since r14-3226-gd073e2d75d9
Date: Sun, 17 Sep 2023 13:09:17 +0000	[thread overview]
Message-ID: <bug-111444-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 111444
           Summary: Wrong code at -O2/3/s on x86_64-gnu since
                    r14-3226-gd073e2d75d9
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: shaohua.li at inf dot ethz.ch
                CC: mjambor at suse dot cz
  Target Milestone: ---

gcc at -O2/3/s produced the wrong code.

Bisected to r14-3226-gd073e2d75d9

Compiler explorer: https://godbolt.org/z/xWj9z8foe

$ cat a.c
int printf(const char *, ...);
int a = 3, d, e;
int *b = &a;
char c;
short f;
const int **g;
static long h(int **i, int **j) {
  const int *k[46];
  const int **l = &k[5];
  *j = &e;
  g = l;
  for (; d; d = d + 1)
    ;
  **i = 0;
  return f;
}
int main() {
  int *m = &a;
  h(&m, &m);
  c = *b;
  printf("%d\n", c);
}
$
$ gcc -O0 a.c && ./a.out
3
$ gcc -O2 a.c && ./a.out
0
$

             reply	other threads:[~2023-09-17 13:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-17 13:09 shaohua.li at inf dot ethz.ch [this message]
2023-09-17 16:19 ` [Bug tree-optimization/111444] [14 Regression] " pinskia at gcc dot gnu.org
2023-09-18  9:14 ` [Bug ipa/111444] " rguenth at gcc dot gnu.org
2024-01-30 17:20 ` jakub at gcc dot gnu.org
2024-01-30 17:53 ` jakub at gcc dot gnu.org
2024-01-30 18:00 ` jakub at gcc dot gnu.org
2024-01-30 18:09 ` jakub at gcc dot gnu.org
2024-01-31  7:37 ` rguenth at gcc dot gnu.org
2024-01-31  9:48 ` rguenth at gcc dot gnu.org
2024-01-31 10:55 ` rguenth at gcc dot gnu.org
2024-01-31 11:31 ` rguenth at gcc dot gnu.org
2024-01-31 12:49 ` cvs-commit at gcc dot gnu.org
2024-01-31 12:49 ` rguenth 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-111444-4@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).