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

            Bug ID: 73450
           Summary: wrong code at -Os and above on x86_64-linux-gnu in
                    both 32-bit and 64-bit modes (executable hangs)
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160810 (experimental) [trunk revision 239341] (GCC)
$ gcc-trunk small.c -O1 ; timeout -s 9 1 ./a.out
$ gcc-trunk small.c -Os ; timeout -s 9 1 ./a.out
Killed
$ gcc-trunk small.c -O3 ; timeout -s 9 1 ./a.out
Killed
$ cat small.c
int a;
char b;
int main() {
  char c = 0;
  for (; c != 3; c = c + 7) {
    a = b & a;
    if (a)
      break;
  }
  return 0;
}
$

Reply via email to