-
Notifications
You must be signed in to change notification settings - Fork 171
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
Hi I just ran into a problem when generating CIR for a simple helloworld c file.
Here is the error message:
zhangzhao@zhangzhao-G3-3579:~/tst_cir$ /tmp/install-llvm/bin/clang -v -emit-cir main.c
clang version 16.0.0 (https://github.com/llvm/clangir.git 07c3d1ed6f639a705e8ca16bb96f7dce2eec9f9e)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /tmp/install-llvm/bin
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
Selected multilib: .;@m64
(in-process)
"/tmp/install-llvm/bin/clang-16" -cc1 -triple x86_64-unknown-linux-gnu -fclangir-enable -emit-cir -disable-free -clear-ast-before-backend -main-file-name main.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -fcoverage-compilation-dir=/home/zhangzhao/tst_cir -resource-dir /tmp/install-llvm/lib/clang/16 -internal-isystem /tmp/install-llvm/lib/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/home/zhangzhao/tst_cir -ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o main.cir -x c main.c
clang -cc1 version 16.0.0 based upon LLVM 16.0.0git default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/tmp/install-llvm/lib/clang/16/include
/usr/local/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
NYI
UNREACHABLE executed at /home/zhangzhao/llvm-project/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp:334!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /tmp/install-llvm/bin/clang -v -emit-cir main.c
1. <eof> parser at end of file
2. main.c:3:5: LLVM IR generation of declaration 'main'
#0 0x0000564774ba9ee7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/tmp/install-llvm/bin/clang+0x23d7ee7)
#1 0x0000564774ba7efe llvm::sys::RunSignalHandlers() (/tmp/install-llvm/bin/clang+0x23d5efe)
#2 0x0000564774b304b8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007f757823bcf0 (/lib/x86_64-linux-gnu/libc.so.6+0x3bcf0)
#4 0x00007f757829226b __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#5 0x00007f757829226b __pthread_kill_internal ./nptl/pthread_kill.c:78:10
#6 0x00007f757829226b pthread_kill ./nptl/pthread_kill.c:89:10
#7 0x00007f757823bc46 raise ./signal/../sysdeps/posix/raise.c:27:6
#8 0x00007f75782227fc abort ./stdlib/abort.c:81:7
#9 0x0000564774b35dbf (/tmp/install-llvm/bin/clang+0x2363dbf)
#10 0x0000564775dd09b7 cir::CIRGenFunction::buildBuiltinExpr(clang::GlobalDecl, unsigned int, clang::CallExpr const*, cir::ReturnValueSlot) (/tmp/install-llvm/bin/clang+0x35fe9b7)
#11 0x0000564775da923d cir::CIRGenFunction::buildCallExpr(clang::CallExpr const*, cir::ReturnValueSlot) (/tmp/install-llvm/bin/clang+0x35d723d)
#12 0x0000564775dbcf65 (anonymous namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*) CIRGenExprScalar.cpp:0:0
#13 0x0000564775db60fc cir::CIRGenFunction::buildScalarExpr(clang::Expr const*) (/tmp/install-llvm/bin/clang+0x35e40fc)
#14 0x0000564775da8230 cir::CIRGenFunction::buildAnyExpr(clang::Expr const*, cir::AggValueSlot, bool) (/tmp/install-llvm/bin/clang+0x35d6230)
#15 0x0000564775da9b6f cir::CIRGenFunction::buildIgnoredExpr(clang::Expr const*) (/tmp/install-llvm/bin/clang+0x35d7b6f)
#16 0x0000564775dca62f cir::CIRGenFunction::buildStmt(clang::Stmt const*, bool) (/tmp/install-llvm/bin/clang+0x35f862f)
#17 0x0000564775dca59f cir::CIRGenFunction::buildCompoundStmtWithoutScope(clang::CompoundStmt const&) (/tmp/install-llvm/bin/clang+0x35f859f)
#18 0x0000564775dc31bc cir::CIRGenFunction::generateCode(clang::GlobalDecl, mlir::cir::FuncOp, cir::CIRGenFunctionInfo const&) (/tmp/install-llvm/bin/clang+0x35f11bc)
#19 0x0000564775d8e205 cir::CIRGenModule::buildGlobalFunctionDefinition(clang::GlobalDecl, mlir::Operation*) (/tmp/install-llvm/bin/clang+0x35bc205)
#20 0x0000564775d91425 cir::CIRGenModule::buildTopLevelDecl(clang::Decl*) (/tmp/install-llvm/bin/clang+0x35bf425)
#21 0x0000564775d8b1cf cir::CIRGenerator::HandleTopLevelDecl(clang::DeclGroupRef) (/tmp/install-llvm/bin/clang+0x35b91cf)
#22 0x0000564775d19c31 cir::CIRGenConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/tmp/install-llvm/bin/clang+0x3547c31)
#23 0x0000564777367509 clang::ParseAST(clang::Sema&, bool, bool) (/tmp/install-llvm/bin/clang+0x4b95509)
#24 0x0000564775632df0 clang::FrontendAction::Execute() (/tmp/install-llvm/bin/clang+0x2e60df0)
#25 0x00005647755a3ddf clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/tmp/install-llvm/bin/clang+0x2dd1ddf)
#26 0x0000564775703662 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/tmp/install-llvm/bin/clang+0x2f31662)
#27 0x000056477389f3be cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/tmp/install-llvm/bin/clang+0x10cd3be)
#28 0x000056477389b70a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#29 0x0000564775418362 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::$_1>(long) Job.cpp:0:0
#30 0x0000564774b301fc llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/tmp/install-llvm/bin/clang+0x235e1fc)
#31 0x0000564775417b8f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/tmp/install-llvm/bin/clang+0x2c45b8f)
#32 0x00005647753d8c4f clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/tmp/install-llvm/bin/clang+0x2c06c4f)
#33 0x00005647753d8efe clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/tmp/install-llvm/bin/clang+0x2c06efe)
#34 0x00005647753f7450 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/tmp/install-llvm/bin/clang+0x2c25450)
#35 0x000056477389aa5e clang_main(int, char**) (/tmp/install-llvm/bin/clang+0x10c8a5e)
#36 0x00007f7578223510 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#37 0x00007f75782235c9 call_init ./csu/../csu/libc-start.c:128:20
#38 0x00007f75782235c9 __libc_start_main ./csu/../csu/libc-start.c:368:5
#39 0x0000564773897935 _start (/tmp/install-llvm/bin/clang+0x10c5935)
clang-16: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 16.0.0 (https://github.com/llvm/clangir.git 07c3d1ed6f639a705e8ca16bb96f7dce2eec9f9e)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /tmp/install-llvm/bin
clang-16: note: diagnostic msg: Error generating preprocessed source(s).
The source file main.c is quite simple as:
#include <stdio.h>
int main(int argc, char** argv) {
int a = 123;
printf("123");
return 0;
}
The CIR clang is built via following guide found from here:
https://llvm.github.io/clangir/GettingStarted/build-install.html
Could anyone help me figuring whats wrong here? Thanks!
lanza and bcardosolopes
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers