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

            Bug ID: 105337
           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: ---

[586] % 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.1/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.1 20220421 (experimental) [master r12-8217-g605a80bb733] (GCC) 
[587] % 
[587] % gcctk -O1 small.c; ./a.out
[588] % 
[588] % gcctk -Os small.c
[589] % ./a.out
Aborted
[590] % 
[590] % cat small.c
int printf(const char *, ...);
int a;
int f() {
  int b, c;
  for (b = 0; b < 3; b++) {
    if (!a)
      break;
    c--;
    printf("%d", c);
  }
  return b;
}
int main() {
  if (f())
    __builtin_abort ();
  return 0;
}

Reply via email to