public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/112721] New: [14 Regression] Wrong code at -O1/s on x86_64-linux-gnu since r14-5831-gaae723d360c
@ 2023-11-27  8:04 shaohua.li at inf dot ethz.ch
  2023-11-27  8:16 ` [Bug tree-optimization/112721] " jamborm at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: shaohua.li at inf dot ethz.ch @ 2023-11-27  8:04 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112721
           Summary: [14 Regression] Wrong code at -O1/s on
                    x86_64-linux-gnu since r14-5831-gaae723d360c
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          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 -O1/s produces the wrong code.

Bisected to r14-5831-gaae723d360c

Compiler explorer: https://godbolt.org/z/671M9YPPj

$ cat a.c
int printf(const char *, ...);
struct a {
  int b;
};
int c, e;
long d;
unsigned *f(unsigned *g) {
  for (; c;)
    e = d;
  return g;
}
int main() {
  int *h;
  struct a i = {8};
  int *j = &i.b;
  h = f(j);
  *h = 0;
  printf("%d\n", i.b);
}
$
$ gcc -O0 a.c && ./a.out
0
$ gcc -O1 a.c && ./a.out
8
$

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

end of thread, other threads:[~2023-11-29 15:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-27  8:04 [Bug tree-optimization/112721] New: [14 Regression] Wrong code at -O1/s on x86_64-linux-gnu since r14-5831-gaae723d360c shaohua.li at inf dot ethz.ch
2023-11-27  8:16 ` [Bug tree-optimization/112721] " jamborm at gcc dot gnu.org
2023-11-27  8:55 ` pinskia at gcc dot gnu.org
2023-11-27 18:17 ` jamborm at gcc dot gnu.org
2023-11-29 15:25 ` cvs-commit at gcc dot gnu.org
2023-11-29 15:27 ` jamborm 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).