[llvm-bugs] [Bug 49788] New: compile-time explosion at -O2

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 31 09:03:28 PDT 2021


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

            Bug ID: 49788
           Summary: compile-time explosion at -O2
           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.

The program, small.c, makes clang hang on in the current trunk version of
clang.
By the way, I am not sure the "f(e)" in function "void l(){f(e);}" is valid or
not, but this program can be compiled in GCC or other versions or options of
clang. 

$cat small.c
#include <stdint.h>
int a, b, c, d;
int e();
int e(){return 1;}
void f() {
  uint8_t g;
  for (; g <= 6;)
    g;
}
void l() { f(e); }
void i() {
  uint8_t *k = &d;
  int64_t *j = b;
  for (*k = 5; *k <= 89; *k += 1)
    if (a - (c *= *j))
      l();
}

$clang -v
clang version 13.0.0 (https://github.com/llvm/llvm-project
5127da029194bbe32421c336b6f249241b658a2b)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/tuhaoxin/github/llvm-project/build-20210330/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
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
Selected multilib: .;@m64

Reproduce on Godbolt: https://godbolt.org/z/ja7M55W6h


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/20210331/0ee992ca/attachment.html>


More information about the llvm-bugs mailing list