Issue 164140
Summary clang crashes at -O1 and above on x86_64-linux-gnu: error in backend: Broken function found, compilation aborted!
Labels clang
Assignees
Reporter zhendongsu
    Compiler Explorer: https://godbolt.org/z/4ra5rrrYb

Note:
- fails: trunk
- works: 21.1.0 and earlier

```
[505] % clangtk -v
clang version 22.0.0git (https://github.com/llvm/llvm-project.git 04e8edcc6ce4fb0693fa9ece24da5f920ccf064b)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/home/suz/suz-local/software/local/clang-trunk/bin
Build config: +assertions
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
Found CUDA installation: /usr/local/cuda, version 12.1
[506] % 
[506] % clangtk -O1 small.c
Instruction does not dominate all uses!
 %and.not27 = select i1 %tobool16.not, i32 %land.ext14, i32 %4
  %6 = trunc i32 %and.not27 to i16
in function main
fatal error: error in backend: Broken function found, compilation aborted!
clangtk: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 22.0.0git (https://github.com/llvm/llvm-project.git 04e8edcc6ce4fb0693fa9ece24da5f920ccf064b)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/home/suz/suz-local/software/local/clang-trunk/bin
Build config: +assertions
clangtk: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clangtk: note: diagnostic msg: /tmp/small-f1d1e5.c
clangtk: note: diagnostic msg: /tmp/small-f1d1e5.sh
clangtk: note: diagnostic msg: 

********************
[507] % 
[507] % cat small.c
int a, b, d, e, f, h;
short c;
int main() {
  if (e) {
    int i = a;
  j:
    if (a < 2)
      while (1)
        ;
    if (a < 3) {
      int l = 0;
      l = f && ~i | l;
      c = (h && 1) & (~(a * d) & ~(b && 1)) >> (i && 1);
 b = d;
    }
  }
  if (a)
    goto j;
  return 0;
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to