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

--- Comment #1 from Zhendong Su <zhendong.su at inf dot ethz.ch> ---
Likely a related instance (although it fails also at -Os and -O2 besides -O3).

Compiler Explorer: https://godbolt.org/z/rdajs47K6

[515] % 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
--enable-checking=yes --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 20221015 (experimental) [master r13-3311-gbaeec7cc83b] (GCC)
[516] %
[516] % gcctk -O1 small.c; ./a.out
[517] %
[517] % gcctk -Os small.c
[518] % ./a.out
Illegal instruction
[519] %
[519] % cat small.c
int a, d, f;
char b, g;
unsigned i;
int main() {
  int c = 300, h = 40;
  char e = 1;
  for (; a < 1; a++) {
    c = ~((i - ~c) | e);
  L1:
    e = f = c;
    if (c)
      if (c > -200)
        e = g % (1 << h);
    char k = 0;
  L2:;
  }
  if (b) {
    if (d)
      goto L2;
    if (!b)
      goto L1;
  }
  return 0;
}

Reply via email to