[Bug tree-optimization/106032] New: wrong code at -Os and above on x86_64-linux-gnu

zhendong.su at inf dot ethz.ch gcc-bugzilla@gcc.gnu.org
Sun Jun 19 20:52:46 GMT 2022


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

            Bug ID: 106032
           Summary: wrong code at -Os 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: ---

This appears to be a regression from 11.*. 

[640] % 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/13.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-sanitizers
--enable-languages=c,c++ --disable-werror --enable-multilib --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.0 20220619 (experimental) [master r13-1166-g4390e7bfbc6] (GCC) 
[641] % 
[641] % gcctk -O1 small.c; ./a.out
[642] % 
[642] % gcctk -Os small.c
[643] % ./a.out
Segmentation fault
[644] % 
[644] % cat small.c
int a, b, c, *d;
int main() {
  int e = 0, f = 0;
  for (; f < 1; f++)
    if (c < 0)
      e = *d;
  if (a) {
    a = b ? 0 : a;
    e && (b = a);
  }
  return 0;
}


More information about the Gcc-bugs mailing list