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

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

[636] % 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 20210705 (experimental) [master revision
59748b71805:2d42892d7cd:8e0b3827bbab6bf92d88d00909ecf8fb43365f39] (GCC) 
[637] % 
[637] % gcctk -O1 small.c; ./a.out
[638] % 
[638] % gcctk -Os small.c
[639] % ./a.out
Aborted
[640] % cat small.c
unsigned a = 0xFFFFFFFF;
int b;
int main()
{
  int c = ~a;
  unsigned d = c - 10;
  if (d > c)
    c = 20;
  b = -(c | 0);
  if (b > -8)
    __builtin_abort ();
  return 0;
}

Reply via email to