public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111631] New: Wrong code at -Os on x86_64-linux-gnu since r14-3217-g4d6132e5932
@ 2023-09-28 13:57 shaohua.li at inf dot ethz.ch
  2023-09-28 15:15 ` [Bug tree-optimization/111631] [14 Regression] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: shaohua.li at inf dot ethz.ch @ 2023-09-28 13:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111631
           Summary: Wrong code at -Os on x86_64-linux-gnu since
                    r14-3217-g4d6132e5932
           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: rguenth at gcc dot gnu.org
  Target Milestone: ---

gcc at -Os produced the wrong code.

Bisected to r14-3217-g4d6132e5932

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

$ cat a.c
int printf(const char *, ...);
short a, f, i;
static const int *e;
short *g;
long h;
int main() {
  {
    unsigned j = i;
    a = 1;
    for (; a; a++) {
      {
        long b = j, d = h;
        int c = 0;
        while (d--)
          *(char *)b++ = c;
      }
      if (e)
        break;
    }
    j && (*g)--;
    const int **k = &e;
    *k = 0;
  }
  printf("%d\n", f);
}
$
$ gcc -O0 a.c && ./a.out
0
$ gcc -Os a.c && ./a.out
Segmentation fault
$ gcc -fsanitize=address,undefined a.c && ./a.out
0
$

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

end of thread, other threads:[~2023-09-28 15:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-28 13:57 [Bug tree-optimization/111631] New: Wrong code at -Os on x86_64-linux-gnu since r14-3217-g4d6132e5932 shaohua.li at inf dot ethz.ch
2023-09-28 15:15 ` [Bug tree-optimization/111631] [14 Regression] " pinskia at gcc dot gnu.org
2023-09-28 15:17 ` pinskia at gcc dot gnu.org
2023-09-28 15:19 ` 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).