llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.4k stars 12.15k forks source link

Crash in SelectionDAG while compiling libc++ test with UBSan enabled #32618

Open vedantk opened 7 years ago

vedantk commented 7 years ago
Bugzilla Link 33271
Version 4.0
OS All
CC @ismail,@bogner

Extended Description

We're crashing in SelectionDAG while attempting to compile a libc++ test with UBSan enabled:

Bot: http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/builds/625

Failure:

******************** TEST 'libc++ :: std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.pass.cpp' FAILED ********************
Command: ['/usr/local/bin/clang++', '-o', '/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/build/projects/libcxx/test/std/experimental/language.support/support.coroutines/end.to.end/Output/bool_await_suspend.pass.cpp.o', '-x', 'c++', '/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/llvm/projects/libcxx/test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.pass.cpp', '-c', '-v', '-D_LIBCPP_DISABLE_AVAILABILITY', '-g', '-fno-omit-frame-pointer', '-fsanitize=undefined', '-fno-sanitize=vptr,function,float-divide-by-zero', '-fno-sanitize-recover=all', '-Werror=thread-safety', '-std=c++1z', '-include', '/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/build/projects/libcxx/__config_site', '-include', '/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/llvm/projects/libcxx/test/support/nasty_macros.hpp', '-nostdinc++', '-I/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/llvm/projects/libcxx/include', '-I/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/build/projects/libcxx/include/c++build', '-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS', '-I/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/llvm/projects/libcxx/test/support', '-DLIBCXX_FILESYSTEM_STATIC_TEST_ROOT="/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/llvm/projects/libcxx/test/std/experimental/filesystem/Inputs/static_test_env"', '-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT="/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/build/projects/libcxx/test/filesystem/Output/dynamic_env"', '-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER="/usr/bin/python2.7 /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/llvm/projects/libcxx/test/support/filesystem_dynamic_test_helper.py"', '-O2', '-fcoroutines-ts', '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER', '-Wall', '-Wextra', '-Werror', '-Wuser-defined-warnings', '-Wshadow', '-Wno-unused-command-line-argument', '-Wno-attributes', '-Wno-pessimizing-move', '-Wno-c++11-extensions', '-Wno-user-defined-literals', '-Wsign-compare', '-Wunused-variable', '-Wunused-parameter', '-Wunreachable-code', '-Wno-conversion', '-Wno-unused-local-typedef', '-Wno-#warnings', '-c']
Exit Code: 254
Standard Error:
--
clang version 5.0.0 (http://llvm.org/git/clang.git 31598e1c84304f0ce0c17fd897035955cbaec8f1) (http://llvm.org/git/llvm.git 1e9afac22cac7385bbc1b0357046b18d89044ac0)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
 "/usr/local/bin/clang-5.0" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name bool_await_suspend.pass.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -momit-leaf-frame-pointer -v -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -coverage-notes-file /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/build/projects/libcxx/test/std/experimental/language.support/support.coroutines/end.to.end/Output/bool_await_suspend.pass.cpp.gcno -nostdinc++ -resource-dir /usr/local/lib/clang/5.0.0 -include /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/build/projects/libcxx/__config_site -include /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/llvm/projects/libcxx/test/support/nasty_macros.hpp -D _LIBCPP_DISABLE_AVAILABILITY -I /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/llvm/projects/libcxx/include -I /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/build/projects/libcxx/include/c++build -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -I /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/llvm/projects/libcxx/test/support -D "LIBCXX_FILESYSTEM_STATIC_TEST_ROOT=\"/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/llvm/projects/libcxx/test/std/experimental/filesystem/Inputs/static_test_env\"" -D "LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT=\"/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/build/projects/libcxx/test/filesystem/Output/dynamic_env\"" -D "LIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER=\"/usr/bin/python2.7 /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/llvm/projects/libcxx/test/support/filesystem_dynamic_test_helper.py\"" -D _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -internal-isystem /usr/local/include -internal-isystem /usr/local/lib/clang/5.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Werror=thread-safety -Wall -Wextra -Werror -Wuser-defined-warnings -Wshadow -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-conversion -Wno-unused-local-typedef -Wno-#warnings -std=c++1z -fdeprecated-macro -fdebug-compilation-dir /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/build/projects/libcxx/test/std/experimental/language.support/support.coroutines/end.to.end -ferror-limit 19 -fmessage-length 0 -fsanitize=alignment,array-bounds,bool,enum,float-cast-overflow,integer-divide-by-zero,nonnull-attribute,null,object-size,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unreachable,vla-bound -fcoroutines-ts -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -vectorize-loops -vectorize-slp -o /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/build/projects/libcxx/test/std/experimental/language.support/support.coroutines/end.to.end/Output/bool_await_suspend.pass.cpp.o -x c++ /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/llvm/projects/libcxx/test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.pass.cpp
clang -cc1 version 5.0.0 based upon LLVM 5.0.0svn default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/llvm/projects/libcxx/include
 /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/build/projects/libcxx/include/c++build
 /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/llvm/projects/libcxx/test/support
 /usr/local/include
 /usr/local/lib/clang/5.0.0/include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
Unknown type!
UNREACHABLE executed at /home/eric/full-llvm/llvm/lib/IR/ValueTypes.cpp:287!
#&#8203;0 0x0000000001c2f774 PrintStackTraceSignalHandler(void*) (/usr/local/bin/clang-5.0+0x1c2f774)
#&#8203;1 0x0000000001c2faa6 SignalHandler(int) (/usr/local/bin/clang-5.0+0x1c2faa6)
#&#8203;2 0x00007f3589c74390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#&#8203;3 0x00007f35887df428 gsignal /build/glibc-9tT8Do/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#&#8203;4 0x00007f35887e102a abort /build/glibc-9tT8Do/glibc-2.23/stdlib/abort.c:91:0
#&#8203;5 0x0000000001be7cc7 (/usr/local/bin/clang-5.0+0x1be7cc7)
#&#8203;6 0x00000000017e87db (/usr/local/bin/clang-5.0+0x17e87db)
#&#8203;7 0x00000000017e7a07 llvm::EVT::getEVT(llvm::Type*, bool) (/usr/local/bin/clang-5.0+0x17e7a07)
#&#8203;8 0x0000000000852c4a llvm::TargetLoweringBase::getValueType(llvm::DataLayout const&, llvm::Type*, bool) const (/usr/local/bin/clang-5.0+0x852c4a)
#&#8203;9 0x000000000141b6e9 llvm::ComputeValueVTs(llvm::TargetLowering const&, llvm::DataLayout const&, llvm::Type*, llvm::SmallVectorImpl<llvm::EVT>&, llvm::SmallVectorImpl<unsigned long>*, unsigned long) (/usr/local/bin/clang-5.0+0x141b6e9)
#&#8203;10 0x000000000237b1ca llvm::SelectionDAGBuilder::visitTargetIntrinsic(llvm::CallInst const&, unsigned int) (/usr/local/bin/clang-5.0+0x237b1ca)
#&#8203;11 0x000000000237c0a0 llvm::SelectionDAGBuilder::visitIntrinsicCall(llvm::CallInst const&, unsigned int) (/usr/local/bin/clang-5.0+0x237c0a0)
#&#8203;12 0x000000000235f67c llvm::SelectionDAGBuilder::visitCall(llvm::CallInst const&) (/usr/local/bin/clang-5.0+0x235f67c)
#&#8203;13 0x0000000002353be6 llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) (/usr/local/bin/clang-5.0+0x2353be6)
#&#8203;14 0x00000000023e1b23 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void>, false, true>, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void>, false, true>, bool&) (/usr/local/bin/clang-5.0+0x23e1b23)
#&#8203;15 0x00000000023e0781 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/usr/local/bin/clang-5.0+0x23e0781)
#&#8203;16 0x00000000023dce34 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/usr/local/bin/clang-5.0+0x23dce34)
#&#8203;17 0x00000000010dc191 (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/usr/local/bin/clang-5.0+0x10dc191)
#&#8203;18 0x00000000014cee34 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/usr/local/bin/clang-5.0+0x14cee34)
#&#8203;19 0x00000000017a6c2f llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/local/bin/clang-5.0+0x17a6c2f)
#&#8203;20 0x00000000017a6e83 llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/local/bin/clang-5.0+0x17a6e83)
#&#8203;21 0x00000000017a7378 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/local/bin/clang-5.0+0x17a7378)
#&#8203;22 0x0000000001db926f 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/local/bin/clang-5.0+0x1db926f)
#&#8203;23 0x00000000024a5951 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/local/bin/clang-5.0+0x24a5951)
#&#8203;24 0x000000000290e2c6 clang::ParseAST(clang::Sema&, bool, bool) (/usr/local/bin/clang-5.0+0x290e2c6)
#&#8203;25 0x0000000002194a28 clang::FrontendAction::Execute() (/usr/local/bin/clang-5.0+0x2194a28)
#&#8203;26 0x000000000214a731 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/local/bin/clang-5.0+0x214a731)
#&#8203;27 0x000000000221a9ee clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/local/bin/clang-5.0+0x221a9ee)
#&#8203;28 0x000000000084278a cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/local/bin/clang-5.0+0x84278a)
#&#8203;29 0x0000000000840c14 main (/usr/local/bin/clang-5.0+0x840c14)
#&#8203;30 0x00007f35887ca830 __libc_start_main /build/glibc-9tT8Do/glibc-2.23/csu/../csu/libc-start.c:325:0
#&#8203;31 0x000000000083dff9 _start (/usr/local/bin/clang-5.0+0x83dff9)
Stack dump:
0.  Program arguments: /usr/local/bin/clang-5.0 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name bool_await_suspend.pass.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -momit-leaf-frame-pointer -v -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -coverage-notes-file /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/build/projects/libcxx/test/std/experimental/language.support/support.coroutines/end.to.end/Output/bool_await_suspend.pass.cpp.gcno -nostdinc++ -resource-dir /usr/local/lib/clang/5.0.0 -include /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/build/projects/libcxx/__config_site -include /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/llvm/projects/libcxx/test/support/nasty_macros.hpp -D _LIBCPP_DISABLE_AVAILABILITY -I /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/llvm/projects/libcxx/include -I /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/build/projects/libcxx/include/c++build -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -I /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/llvm/projects/libcxx/test/support -D LIBCXX_FILESYSTEM_STATIC_TEST_ROOT="/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/llvm/projects/libcxx/test/std/experimental/filesystem/Inputs/static_test_env" -D LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT="/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/build/projects/libcxx/test/filesystem/Output/dynamic_env" -D LIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER="/usr/bin/python2.7 /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/llvm/projects/libcxx/test/support/filesystem_dynamic_test_helper.py" -D _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -internal-isystem /usr/local/include -internal-isystem /usr/local/lib/clang/5.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Werror=thread-safety -Wall -Wextra -Werror -Wuser-defined-warnings -Wshadow -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-conversion -Wno-unused-local-typedef -Wno-#warnings -std=c++1z -fdeprecated-macro -fdebug-compilation-dir /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/build/projects/libcxx/test/std/experimental/language.support/support.coroutines/end.to.end -ferror-limit 19 -fmessage-length 0 -fsanitize=alignment,array-bounds,bool,enum,float-cast-overflow,integer-divide-by-zero,nonnull-attribute,null,object-size,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unreachable,vla-bound -fcoroutines-ts -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -vectorize-loops -vectorize-slp -o /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/build/projects/libcxx/test/std/experimental/language.support/support.coroutines/end.to.end/Output/bool_await_suspend.pass.cpp.o -x c++ /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/llvm/projects/libcxx/test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.pass.cpp 
1.  <eof> parser at end of file
2.  Code generation
3.  Running pass 'Function Pass Manager' on module '/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/llvm/projects/libcxx/test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.pass.cpp'.
4.  Running pass 'X86 DAG->DAG Instruction Selection' on function '@_Z1gv'
clang-5.0: error: unable to execute command: Aborted (core dumped)
clang-5.0: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 5.0.0 (http://llvm.org/git/clang.git 31598e1c84304f0ce0c17fd897035955cbaec8f1) (http://llvm.org/git/llvm.git 1e9afac22cac7385bbc1b0357046b18d89044ac0)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-5.0: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
clang-5.0: note: diagnostic msg: 
********************
ismail commented 7 years ago

The full log is available on https://build.opensuse.org/public/build/home:namtrac:clang/openSUSE_Factory/x86_64/clang-trunk/_log but I am afraid the backtraces won't help much.

llvmbot commented 7 years ago

İsmail Dönmez,

Can you add the details (stack + commit of the binaries uses on Suse)?

Thank you, Gor

ismail commented 7 years ago

FWIW this blows up with glibc's MALLOCCHECK which is enabled in openSUSE builders.

llvmbot commented 7 years ago

Fixed:

Differential Revision: https://reviews.llvm.org/D33817

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304518 91177308-0d34-0410-b5e6-96231b3b80d8
llvmbot commented 7 years ago

Looking...

llvmbot commented 7 years ago

Any chance you can reduce this, Vedant?

Thanks!

vedantk commented 7 years ago

An additional detail: the crash doesn't appear to affect the Darwin sanitizer bots, so XFAILing these tests isn't an option.