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

            Bug ID: 112281
           Summary: wrong code at -O3 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: ---

This is a regression from 11.*, and affects 12.* and later. It should be
distinct from those couple of open issues with loop splitting. 

Compiler Explorer: https://godbolt.org/z/1anT983Td

[573] % 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/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231029 (experimental) (GCC) 
[574] % 
[574] % gcctk -O2 small.c; ./a.out
[575] % 
[575] % gcctk -O3 small.c; ./a.out
Aborted
[576] % gcctk -O3 -fno-split-loops small.c; ./a.out
Aborted
[577] % 
[577] % cat small.c
struct {
  int : 8;
  int a;
} b, d[4] = {{0}, {0}, {0}, {5}};
int c, e;
int main() {
  for (c = 2; c; c--)
    for (e = 0; e < 2; e++) {
      d[c] = b = d[c + 1];
      d[c + 1].a = 0;
    }
  if (b.a != 0)
    __builtin_abort();
  return 0;
}

Reply via email to