[llvm-bugs] [Bug 45226] New: clang crash in CodeGenModule.cpp

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 17 08:59:30 PDT 2020


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

            Bug ID: 45226
           Summary: clang crash in CodeGenModule.cpp
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tangyixuan at mail.dlut.edu.cn
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

Hi, clang++ crash when given the following example. g++ can compile normally.
$ cat 1.C
int fum (); 
int fum () __attribute__ ((target("default")));

int fum () __attribute__((target( "sse")));

int (*p)() = &fum;

$ clang++ -std=c++11 -c 1.C

None multiversion type isn't valid here
UNREACHABLE executed at
/home/oscar/compiler/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:1023!
Stack dump:
0.      Program arguments: /usr/local/bin/clang-9 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
1.C -mrelocation-model static -mthread-model posix -mframe-pointer=all
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb
-resource-dir /usr/local/lib/clang/10.0.0 -internal-isystem
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0
-internal-isystem
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/x86_64-pc-linux-gnu
-internal-isystem
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/lib/clang/10.0.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++11 -fdeprecated-macro
-fdebug-compilation-dir
/media/oscar/xuaner1/autogeneration/testsuitC++/compileinformation/gcc5.2.0-crash-testsuit/clang
-ferror-limit 19 -fmessage-length 0 -fgnuc-version=4.2.1 -fobjc-runtime=gcc
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics
-faddrsig -o 1.o -x c++ 1.C 
1.      <eof> parser at end of file
2.      1.C:6:7: LLVM IR generation of declaration 'p'
3.      1.C:6:7: Generating code for declaration 'p'
 #0 0x000055c114bbc05f llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/oscar/compiler/llvm-project/llvm/lib/Support/Unix/Signals.inc:544:0
 #1 0x000055c114bbc0f2 PrintStackTraceSignalHandler(void*)
/home/oscar/compiler/llvm-project/llvm/lib/Support/Unix/Signals.inc:605:0
 #2 0x000055c114bb9f55 llvm::sys::RunSignalHandlers()
/home/oscar/compiler/llvm-project/llvm/lib/Support/Signals.cpp:68:0
 #3 0x000055c114bbb9ea SignalHandler(int)
/home/oscar/compiler/llvm-project/llvm/lib/Support/Unix/Signals.inc:391:0
 #4 0x00007f081edd4890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #5 0x00007f081decce97 raise (/lib/x86_64-linux-gnu/libc.so.6+0x3ee97)
 #6 0x00007f081dece801 abort (/lib/x86_64-linux-gnu/libc.so.6+0x40801)
 #7 0x000055c114afc2a8 bindingsErrorHandler(void*,
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, bool)
/home/oscar/compiler/llvm-project/llvm/lib/Support/ErrorHandling.cpp:218:0
 #8 0x000055c11503b4b0 getMangledNameImpl(clang::CodeGen::CodeGenModule const&,
clang::GlobalDecl, clang::NamedDecl const*, bool)
/home/oscar/compiler/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:1027:0
 #9 0x000055c11503bb60
clang::CodeGen::CodeGenModule::getMangledName(clang::GlobalDecl)
/home/oscar/compiler/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:1094:0
#10 0x000055c11504711c
clang::CodeGen::CodeGenModule::GetAddrOfFunction(clang::GlobalDecl,
llvm::Type*, bool, bool, clang::CodeGen::ForDefinition_t)
/home/oscar/compiler/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:3287:0
#11 0x000055c114f6b124 (anonymous
namespace)::ConstantLValueEmitter::tryEmitBase(clang::APValue::LValueBase
const&)
/home/oscar/compiler/llvm-project/clang/lib/CodeGen/CGExprConstant.cpp:1871:0
#12 0x000055c114f6aed3 (anonymous namespace)::ConstantLValueEmitter::tryEmit()
/home/oscar/compiler/llvm-project/clang/lib/CodeGen/CGExprConstant.cpp:1822:0
#13 0x000055c114f6bdab
clang::CodeGen::ConstantEmitter::tryEmitPrivate(clang::APValue const&,
clang::QualType)
/home/oscar/compiler/llvm-project/clang/lib/CodeGen/CGExprConstant.cpp:2019:0
#14 0x000055c114f6a796
clang::CodeGen::ConstantEmitter::tryEmitPrivateForMemory(clang::APValue const&,
clang::QualType)
/home/oscar/compiler/llvm-project/clang/lib/CodeGen/CGExprConstant.cpp:1663:0
#15 0x000055c114f6a4a0
clang::CodeGen::ConstantEmitter::tryEmitPrivateForVarInit(clang::VarDecl
const&)
/home/oscar/compiler/llvm-project/clang/lib/CodeGen/CGExprConstant.cpp:1617:0
#16 0x000055c114f6942c
clang::CodeGen::ConstantEmitter::tryEmitForInitializer(clang::VarDecl const&)
/home/oscar/compiler/llvm-project/clang/lib/CodeGen/CGExprConstant.cpp:1392:0
#17 0x000055c115049b17
clang::CodeGen::CodeGenModule::EmitGlobalVarDefinition(clang::VarDecl const*,
bool)
/home/oscar/compiler/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:3904:0
#18 0x000055c115044781
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
/home/oscar/compiler/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2829:0
#19 0x000055c115043253
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
/home/oscar/compiler/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2529:0
#20 0x000055c11504f914
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*)
/home/oscar/compiler/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:5239:0
#21 0x000055c115ef12f9 (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
/home/oscar/compiler/llvm-project/clang/lib/CodeGen/ModuleBuilder.cpp:169:0
#22 0x000055c115eea1d2
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
/home/oscar/compiler/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:175:0
#23 0x000055c11756fb26 clang::ParseAST(clang::Sema&, bool, bool)
/home/oscar/compiler/llvm-project/clang/lib/Parse/ParseAST.cpp:162:0
#24 0x000055c11563f33b clang::ASTFrontendAction::ExecuteAction()
/home/oscar/compiler/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1042:0
#25 0x000055c115ee8be2 clang::CodeGenAction::ExecuteAction()
/home/oscar/compiler/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1089:0
#26 0x000055c11563ec9c clang::FrontendAction::Execute()
/home/oscar/compiler/llvm-project/clang/lib/Frontend/FrontendAction.cpp:939:0
#27 0x000055c1155d6f17
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/oscar/compiler/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:956:0
#28 0x000055c1157a6a9b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/oscar/compiler/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:290:0
#29 0x000055c1122930bf cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) /home/oscar/compiler/llvm-project/clang/tools/driver/cc1_main.cpp:250:0
#30 0x000055c112288613 ExecuteCC1Tool(llvm::ArrayRef<char const*>,
llvm::StringRef)
/home/oscar/compiler/llvm-project/clang/tools/driver/driver.cpp:309:0
#31 0x000055c112288d09 main
/home/oscar/compiler/llvm-project/clang/tools/driver/driver.cpp:382:0
#32 0x00007f081deafb97 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21b97)
#33 0x000055c112286dea _start (/usr/local/bin/clang-9+0x2b39dea)
clang-9: error: unable to execute command: Aborted (core dumped)
clang-9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 10.0.0 (https://github.com/llvm/llvm-project.git
722b61892454b3217d73ec486e52156c5a92b5b3)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-9: 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-9: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-9: note: diagnostic msg: /tmp/1-68d277.cpp
clang-9: note: diagnostic msg: /tmp/1-68d277.sh
clang-9: 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/20200317/12bd08c4/attachment-0001.html>


More information about the llvm-bugs mailing list