[llvm-bugs] [Bug 46125] New: Assertion `isa<Argument>(Val) && "Unknown live-in to the entry block"' failed, crash on release

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 28 11:02:15 PDT 2020


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

            Bug ID: 46125
           Summary: Assertion `isa<Argument>(Val) && "Unknown live-in to
                    the entry block"' failed, crash on release
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: changochen1 at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

We found an bug in optimizer that crashes clang (release version) and triggers
an assertion on debug version. Clang version started from 9 is affected.

CMD:
---
clang -O3 poc.c
---

POC:
---
int a, b;
int main() {
  switch (a)
  case 4:
  case 7:
    return a;
  a = b;
  main();
}
---

Stack dump:
---
Stack dump:
0.      Program arguments: /usr/lib/llvm-9/bin/clang -cc1 -triple
x86_64-pc-linux-gnu -emit-obj -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name crash.c -mrelocation-model static
-mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info
-debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir
/usr/lib/llvm-9/lib/clang/9.0.0 -internal-isystem /usr/local/include
-internal-isystem /usr/lib/llvm-9/lib/clang/9.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O3
-fdebug-compilation-dir /home/yongheng -ferror-limit 19 -fmessage-length 0
-fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics
-vectorize-loops -vectorize-slp -faddrsig -o /tmp/crash-577133.o -x c crash.c
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'crash.c'.
4.      Running pass 'Simple Register Coalescing' on function '@main'
 #0 0x00007fa30f10a35f llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xa3835f)
 #1 0x00007fa30f108780 llvm::sys::RunSignalHandlers()
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xa36780)
 #2 0x00007fa30f10a761 (/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xa38761)
 #3 0x00007fa314d8f890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x00007fa30f489134 (/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xdb7134)
 #5 0x00007fa30f4826ed (/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xdb06ed)
 #6 0x00007fa30f481076 (/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xdaf076)
 #7 0x00007fa30f4803cd (/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xdae3cd)
 #8 0x00007fa30f392988
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xcc0988)
 #9 0x00007fa30f209246 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xb37246)
#10 0x00007fa30f2094f3 llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xb374f3)
#11 0x00007fa30f2099a0 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xb379a0)
#12 0x00007fa313b115f6 EmitAssembly
/build/llvm-toolchain-9-uSl4bC/llvm-toolchain-9-9/tools/clang/lib/CodeGen/BackendUtil.cpp:899:3
#13 0x00007fa313b115f6 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
/build/llvm-toolchain-9-uSl4bC/llvm-toolchain-9-9/tools/clang/lib/CodeGen/BackendUtil.cpp:1498:15
#14 0x00007fa313d47ead ~unique_ptr
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/unique_ptr.h:267:6
#15 0x00007fa313d47ead HandleTranslationUnit
/build/llvm-toolchain-9-uSl4bC/llvm-toolchain-9-9/tools/clang/lib/CodeGen/CodeGenAction.cpp:303:7
#16 0x00007fa313077a03 __normal_iterator
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_iterator.h:783:20
#17 0x00007fa313077a03 begin
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_vector.h:564:16
#18 0x00007fa313077a03
finalize<std::vector<std::unique_ptr<clang::TemplateInstantiationCallback,
std::default_delete<clang::TemplateInstantiationCallback> >,
std::allocator<std::unique_ptr<clang::TemplateInstantiationCallback,
std::default_delete<clang::TemplateInstantiationCallback> > > > >
/build/llvm-toolchain-9-uSl4bC/llvm-toolchain-9-9/tools/clang/include/clang/Sema/TemplateInstCallback.h:54:16
#19 0x00007fa313077a03 clang::ParseAST(clang::Sema&, bool, bool)
/build/llvm-toolchain-9-uSl4bC/llvm-toolchain-9-9/tools/clang/lib/Parse/ParseAST.cpp:178:3
#20 0x00007fa3143194c8 clang::FrontendAction::Execute()
/build/llvm-toolchain-9-uSl4bC/llvm-toolchain-9-9/tools/clang/lib/Frontend/FrontendAction.cpp:938:10
#21 0x00007fa3142d8ce0 getPtr
/build/llvm-toolchain-9-uSl4bC/llvm-toolchain-9-9/include/llvm/Support/Error.h:273:42
#22 0x00007fa3142d8ce0 operator bool
/build/llvm-toolchain-9-uSl4bC/llvm-toolchain-9-9/include/llvm/Support/Error.h:236:16
#23 0x00007fa3142d8ce0
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/build/llvm-toolchain-9-uSl4bC/llvm-toolchain-9-9/tools/clang/lib/Frontend/CompilerInstance.cpp:944:23
#24 0x00007fa31437c210
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/build/llvm-toolchain-9-uSl4bC/llvm-toolchain-9-9/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:291:25
#25 0x0000000000498a5b cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/lib/llvm-9/bin/clang+0x498a5b)
#26 0x0000000000496d71 main (/usr/lib/llvm-9/bin/clang+0x496d71)
#27 0x00007fa30d9c3b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#28 0x00000000004941ea _start (/usr/lib/llvm-9/bin/clang+0x4941ea)
clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 9.0.0-2~ubuntu18.04.2 (tags/RELEASE_900/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang: note: diagnostic msg:
********************

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

********************
---

-- 
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/20200528/a03a088b/attachment-0001.html>


More information about the llvm-bugs mailing list