public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111469] New: Wrong code at -Os on x86_64-linux-gnu since r14-573-g69f1a8af45
@ 2023-09-19  7:16 shaohua.li at inf dot ethz.ch
  2023-09-19  7:22 ` [Bug tree-optimization/111469] " pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: shaohua.li at inf dot ethz.ch @ 2023-09-19  7:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111469
           Summary: Wrong code at -Os on x86_64-linux-gnu since
                    r14-573-g69f1a8af45
           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: pinskia at gcc dot gnu.org
  Target Milestone: ---

gcc at -Os produced the wrong code.

Bisected to r14-573-g69f1a8af45

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

$ cat a.c
int printf(const char *, ...);
int a;
long b, c, e, f;
char *g;
unsigned short h = 5;
static unsigned short *i = &h;
unsigned j;
long k(long m, long n) {
  if (n)
    e = m;
  c = e;
  return e;
}
char o() {
  char l;
  while (f)
    ;
  l = *g;
  return l;
}
int main() {
  int p;
  int q;
  for (; j - 9 >= 29; j = k(-95, *i) + 127) {
    *i || o();
    long d = h;
    p = d == 0 ? 0 : b % d;
    q = p;
    int *r[1] = {&q};
  }
  printf("%d\n", a);
}
$
$ gcc a.c && ./a.out
0
$ gcc a.c -Os && ./a.out
segmentation fault
$

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

end of thread, other threads:[~2023-09-26 14:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-19  7:16 [Bug tree-optimization/111469] New: Wrong code at -Os on x86_64-linux-gnu since r14-573-g69f1a8af45 shaohua.li at inf dot ethz.ch
2023-09-19  7:22 ` [Bug tree-optimization/111469] " pinskia at gcc dot gnu.org
2023-09-19  7:50 ` [Bug tree-optimization/111469] [14 Regression] " pinskia at gcc dot gnu.org
2023-09-19  7:51 ` pinskia at gcc dot gnu.org
2023-09-19  8:17 ` pinskia at gcc dot gnu.org
2023-09-20  5:07 ` pinskia at gcc dot gnu.org
2023-09-21  8:10 ` pinskia at gcc dot gnu.org
2023-09-24 19:17 ` pinskia at gcc dot gnu.org
2023-09-26 14:55 ` cvs-commit at gcc dot gnu.org
2023-09-26 14:56 ` pinskia 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).