public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/101031] New: wrong code at -O2 on x86_64-linux-gnu
@ 2021-06-11 13:28 qrzhang at gatech dot edu
  2021-06-11 13:29 ` [Bug tree-optimization/101031] " qrzhang at gatech dot edu
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: qrzhang at gatech dot edu @ 2021-06-11 13:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101031
           Summary: wrong code at -O2 on x86_64-linux-gnu
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: qrzhang at gatech dot edu
  Target Milestone: ---

It appears to be a recent regression.


$ gcc-trunk -v
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210611 (experimental) [master revision
336c41dbcb2:00da4bcb67d:36943c6bdd3d3b535b24872bbd802d91ef0c6299] (GCC)


$ gcc-trunk abc.c ; ./a.out
0

$ gcc-trunk -O2 abc.c ; ./a.out
1


$ cat abc.c
int a;
char b, e;
static char *c = &b;
static long d;
void f(void);
void h() {
  int g = 0;
  for (; g < 2; ++g) {
    d = *c;
    *c = 1;
    b = 0;
  }
  f();
}
void f() {
  if (d++)
    c = &e;
  for (; a;)
    ;
}
int main() {
  h();
  printf("%d\n", b);
}

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

end of thread, other threads:[~2021-06-14 10:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-11 13:28 [Bug tree-optimization/101031] New: wrong code at -O2 on x86_64-linux-gnu qrzhang at gatech dot edu
2021-06-11 13:29 ` [Bug tree-optimization/101031] " qrzhang at gatech dot edu
2021-06-11 13:31 ` [Bug tree-optimization/101031] [12 Regression] " jakub at gcc dot gnu.org
2021-06-11 13:48 ` rguenth at gcc dot gnu.org
2021-06-11 13:52 ` rguenth at gcc dot gnu.org
2021-06-14  7:35 ` rguenth at gcc dot gnu.org
2021-06-14  9:14 ` cvs-commit at gcc dot gnu.org
2021-06-14 10:21 ` rguenth 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).