Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

clang crash with '-O1 -fno-plt -m32' (on amd64) #42460

Open Quuxplusone opened 5 years ago

Quuxplusone commented 5 years ago
Bugzilla Link PR43490
Status NEW
Importance P normal
Reported by Michał Górny (mgorny@gentoo.org)
Reported on 2019-09-28 02:09:03 -0700
Last modified on 2020-01-18 10:06:10 -0800
Version trunk
Hardware PC Linux
CC cygnus@michiru.ru, htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, mati865@gmail.com, mbartoszkiewicz@gmail.com, neeilans@live.com, richard-llvm@metafoo.co.uk
Fixed by commit(s)
Attachments wrappers_c-d34ae5.cpp (63 bytes, text/x-c++src)
Blocks
Blocked by
See also
Created attachment 22596
wrappers_c-d34ae5.cpp

Original bug report: https://bugs.gentoo.org/695618

Reduced test case (courtesy of Sergei Trofimovich) attached.

Tested with fresh LLVM+Clang trunk.

To reproduce:
$ clang -O1 -fno-plt -m32 wrappers_c-d34ae5.cpp
Stack dump:
0.  Program arguments: /usr/lib64/llvm/10/bin/clang-10 -cc1 -triple i386-pc-
linux-gnu -emit-obj -disable-free -main-file-name wrappers_c-d34ae5.cpp -
mrelocation-model static -mthread-model posix -mframe-pointer=none -fmath-errno
-masm-verbose -mconstructor-aliases -fno-plt -fuse-init-array -target-cpu
pentium4 -dwarf-column-info -debugger-tuning=gdb -resource-dir
/usr/lib64/llvm/10/bin/../../../../lib/clang/10.0.0 -internal-isystem
/usr/lib/gcc/x86_64-pc-linux-gnu/7.4.0/include/g++-v7 -internal-isystem
/usr/lib/gcc/x86_64-pc-linux-gnu/7.4.0/include/g++-v7/x86_64-pc-linux-gnu/32 -
internal-isystem /usr/lib/gcc/x86_64-pc-linux-gnu/7.4.0/include/g++-v7/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/lib64/llvm/10/bin/../../../../lib/clang/10.0.0/include -internal-externc-
isystem /include -internal-externc-isystem /usr/include -O1 -fdeprecated-macro -
fdebug-compilation-dir /var/tmp -ferror-limit 19 -fmessage-length 0 -fobjc-
runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o
wrappers_c-d34ae5.o -x c++ wrappers_c-d34ae5.cpp
1.  <eof> parser at end of file
2.  Code generation
3.  Running pass 'Function Pass Manager' on module 'wrappers_c-d34ae5.cpp'.
4.  Running pass 'Machine Common Subexpression Elimination' on function '@_Z1bv'
 #0 0x00007f173e9a6b01 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/lib64/llvm/10/bin/../lib64/libLLVMSupport.so.10svn+0x1eeb01)
 #1 0x00007f173e9a6b70 (/usr/lib64/llvm/10/bin/../lib64/libLLVMSupport.so.10svn+0x1eeb70)
 #2 0x00007f173e9a3f75 llvm::sys::RunSignalHandlers() (/usr/lib64/llvm/10/bin/../lib64/libLLVMSupport.so.10svn+0x1ebf75)
 #3 0x00007f173e9a4155 (/usr/lib64/llvm/10/bin/../lib64/libLLVMSupport.so.10svn+0x1ec155)
 #4 0x00007f173b2a6d50 __restore_rt (/lib64/libc.so.6+0x36d50)
 #5 0x00007f17418618f4 (/usr/lib64/llvm/10/bin/../lib64/libLLVMCodeGen.so.10svn+0x2f18f4)
 #6 0x00007f1741868438 (/usr/lib64/llvm/10/bin/../lib64/libLLVMCodeGen.so.10svn+0x2f8438)
 #7 0x00007f174186a296 (/usr/lib64/llvm/10/bin/../lib64/libLLVMCodeGen.so.10svn+0x2fa296)
 #8 0x00007f174186a452 (/usr/lib64/llvm/10/bin/../lib64/libLLVMCodeGen.so.10svn+0x2fa452)
 #9 0x00007f174188fe26 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/usr/lib64/llvm/10/bin/../lib64/libLLVMCodeGen.so.10svn+0x31fe26)
#10 0x00007f174105115a llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/lib64/llvm/10/bin/../lib64/libLLVMCore.so.10svn+0x25115a)
#11 0x00007f17410513c6 llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/lib64/llvm/10/bin/../lib64/libLLVMCore.so.10svn+0x2513c6)
#12 0x00007f17410517f6
(/usr/lib64/llvm/10/bin/../lib64/libLLVMCore.so.10svn+0x2517f6)
#13 0x00007f1741051b7f llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/lib64/llvm/10/bin/../lib64/libLLVMCore.so.10svn+0x251b7f)
#14 0x00007f1741051c11 llvm::legacy::PassManager::run(llvm::Module&)
(/usr/lib64/llvm/10/bin/../lib64/libLLVMCore.so.10svn+0x251c11)
#15 0x00007f173cda2489
(/usr/lib64/llvm/10/bin/../lib64/libclangCodeGen.so.10svn+0xf2489)
#16 0x00007f173cda2f04 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> >)
(/usr/lib64/llvm/10/bin/../lib64/libclangCodeGen.so.10svn+0xf2f04)
#17 0x00007f173d0d335b
(/usr/lib64/llvm/10/bin/../lib64/libclangCodeGen.so.10svn+0x42335b)
#18 0x00007f1733555099 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/lib64/llvm/10/bin/../lib64/../lib64/libclangParse.so.10svn+0x35099)
#19 0x00007f173c47a0f9 clang::ASTFrontendAction::ExecuteAction()
(/usr/lib64/llvm/10/bin/../lib64/libclangFrontend.so.10svn+0x1120f9)
#20 0x00007f173d0cc29f clang::CodeGenAction::ExecuteAction()
(/usr/lib64/llvm/10/bin/../lib64/libclangCodeGen.so.10svn+0x41c29f)
#21 0x00007f173c47ba6b clang::FrontendAction::Execute()
(/usr/lib64/llvm/10/bin/../lib64/libclangFrontend.so.10svn+0x113a6b)
#22 0x00007f173c431006
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/lib64/llvm/10/bin/../lib64/libclangFrontend.so.10svn+0xc9006)
#23 0x00007f173c15e5f6
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/lib64/llvm/10/bin/../lib64/libclangFrontendTool.so.10svn+0x65f6)
#24 0x0000557d60a9b6bb cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/lib64/llvm/10/bin/clang-10+0x166bb)
#25 0x0000557d60a953a2 (/usr/lib64/llvm/10/bin/clang-10+0x103a2)
#26 0x0000557d60a98cee main (/usr/lib64/llvm/10/bin/clang-10+0x13cee)
#27 0x00007f173b291e77 __libc_start_main /var/tmp/portage/sys-libs/glibc-2.28-
r5/work/glibc-2.28/csu/../csu/libc-start.c:342:0
#28 0x0000557d60a943da _start (/usr/lib64/llvm/10/bin/clang-10+0xf3da)
clang-10: error: unable to execute command: Segmentation fault
clang-10: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 10.0.0 (/var/tmp/portage/sys-devel/clang-
10.0.0.9999/work/x/y/clang-10.0.0.9999 95e1920019249e0a20e850ca678d46df9c7b57e7)
Target: i386-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/10/bin
clang-10: note: diagnostic msg: PLEASE submit a bug report to  and include the
crash backtrace, preprocessed source, and associated run script.
clang-10: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-10: note: diagnostic msg: /tmp/wrappers_c-d34ae5-018012.cpp
clang-10: note: diagnostic msg: /tmp/wrappers_c-d34ae5-018012.sh
clang-10: note: diagnostic msg:

********************
Quuxplusone commented 5 years ago

Attached wrappers_c-d34ae5.cpp (63 bytes, text/x-c++src): wrappers_c-d34ae5.cpp