[llvm-bugs] [Bug 51841] New: compile-time explosion at -O3

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 14 01:07:57 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=51841

            Bug ID: 51841
           Summary: compile-time explosion at -O3
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: haoxintu at gmail.com
                CC: llvm-bugs at lists.llvm.org

Hi all.

It's quite weird that this simple valid code makes clang-10 to clang-trunk
versions hang at -O3. This issue only happens when "-g -O3" is enabled.

$cat small.c
#include <stdint.h>
int a, b, c, d;
e() {
  if (a)
    ;
  else {
    uint32_t *f = &d;
    for (*f = 4; *f <= 33; *f += 1)
      for (b = -27; b <= 48; b++) {
        int16_t g;
        int32_t *i = e;
        (c -= 10) % (g = c ^= i != 0);
        a &= b;
      }
  }
}

$clang -w -g -O3 small.c
//endless compiling

$clang -v
clang version 14.0.0 (https://github.com/llvm/llvm-project
203cd01b54ddd720be17b8e19207ff5af4a22d4c)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/haoxin/haoxin-data/compilers/llvm-project/build/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

Reproduced in Godbolt: https://godbolt.org/z/YacWx1fnE

Thanks,
Haoxin

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210914/4b10e134/attachment-0001.html>


More information about the llvm-bugs mailing list