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

            Bug ID: 102364
           Summary: wrong code at -O1 and above 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: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

[581] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++
--disable-werror --enable-multilib --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210916 (experimental) [master r12-3577-g275a076f762] (GCC) 
[582] % 
[582] % gcctk -O0 small.c; a.out
[583] % 
[583] % gcctk -O1 small.c
[584] % ./a.out
Aborted
[585] % 
[585] % cat small.c
int a, b, *c = &b;
short d;
int main() {
  unsigned e = 1;
  for (d = 9; d > 8; d += 2) {
    int *f = &a, **g = &f;
    if (d > ++e)
      *g = c;
    if (f != &b)
      __builtin_abort ();
  }
  return 0;
}

Reply via email to