llvm / llvm-project

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

Reliable segfault when building LLVM (scudo, clang_rt) via AUR package #48032

Open reinderien opened 3 years ago

reinderien commented 3 years ago
Bugzilla Link 48688
Version unspecified
OS Linux
Attachments [https://user-images.githubusercontent.com/92601349/143761614-7bf94d43-e816-46c9-8cde-9a0fd6b99f8f.gz), [https://user-images.githubusercontent.com/92601349/143761615-65a8d17c-fec3-4f7c-88fb-ffb8e4c35fdc.gz), [https://user-images.githubusercontent.com/92601349/143761616-0fbc8b99-19b4-40b4-b222-5d9fbf23d85b.gz), [https://user-images.githubusercontent.com/92601349/143761618-513bf00a-8185-4ca4-b15b-3651d0379676.gz), [https://user-images.githubusercontent.com/92601349/143761619-29bfd2af-319f-465f-8e3f-a6ee453c74a0.gz), [https://user-images.githubusercontent.com/92601349/143761620-970096b5-93e7-429b-ad63-047527746710.gz)

Extended Description

The AUR package swift-language pulls in clang tools as a dependency. After a lengthy build, it failed with several stack traces:

...

[1104/1351][ 81%][65.305s] Building CXX object lib/scudo/standalone/CMakeFiles/RTScudoStandaloneCxxWrappers.i386.dir/wrappers_cpp.cpp.o FAILED: lib/scudo/standalone/CMakeFiles/RTScudoStandaloneCxxWrappers.i386.dir/wrappers_cpp.cpp.o /home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang++ -I/home/gtoombs/.cache/yay/swift-language/src/llvm-project/compiler-rt/lib/scudo/standalone/../.. -I/home/gtoombs/.cache/yay/swift-language/src/llvm-project/compiler-rt/lib/scudo/standalone/include -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -Wall -std=c++14 -Wno-unused-parameter -O3 -DNDEBUG -m32 -Werror=conversion -Wall -nostdinc++ -ffreestanding -fvisibility=hidden -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -O3 -DGWP_ASAN_HOOKS -MD -MT lib/scudo/standalone/CMakeFiles/RTScudoStandaloneCxxWrappers.i386.dir/wrappers_cpp.cpp.o -MF lib/scudo/standalone/CMakeFiles/RTScudoStandaloneCxxWrappers.i386.dir/wrappers_cpp.cpp.o.d -o lib/scudo/standalone/CMakeFiles/RTScudoStandaloneCxxWrappers.i386.dir/wrappers_cpp.cpp.o -c /home/gtoombs/.cache/yay/swift-language/src/llvm-project/compiler-rt/lib/scudo/standalone/wrappers_cpp.cpp PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script. Stack dump:

  1. Program arguments: /home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang++ -I/home/gtoombs/.cache/yay/swift-language/src/llvm-project/compiler-rt/lib/scudo/standalone/../.. -I/home/gtoombs/.cache/yay/swift-language/src/llvm-project/compiler-rt/lib/scudo/standalone/include -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -Wall -std=c++14 -Wno-unused-parameter -O3 -DNDEBUG -m32 -Werror=conversion -Wall -nostdinc++ -ffreestanding -fvisibility=hidden -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -O3 -DGWP_ASAN_HOOKS -MD -MT lib/scudo/standalone/CMakeFiles/RTScudoStandaloneCxxWrappers.i386.dir/wrappers_cpp.cpp.o -MF lib/scudo/standalone/CMakeFiles/RTScudoStandaloneCxxWrappers.i386.dir/wrappers_cpp.cpp.o.d -o lib/scudo/standalone/CMakeFiles/RTScudoStandaloneCxxWrappers.i386.dir/wrappers_cpp.cpp.o -c /home/gtoombs/.cache/yay/swift-language/src/llvm-project/compiler-rt/lib/scudo/standalone/wrappers_cpp.cpp
  2. parser at end of file
  3. Code generation
  4. Running pass 'Function Pass Manager' on module '/home/gtoombs/.cache/yay/swift-language/src/llvm-project/compiler-rt/lib/scudo/standalone/wrappers_cpp.cpp'.
  5. Running pass 'Machine Common Subexpression Elimination' on function '@_ZN5scudo9AllocatorINS_13DefaultConfigEXadL_Z15malloc_postinitEEE8allocateEmNS_5Chunk6OriginEmb'

    ​0 0x0000562f85ae38d4 PrintStackTraceSignalHandler(void*) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x24448d4)

    ​1 0x0000562f85ae149e llvm::sys::RunSignalHandlers() (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x244249e)

    ​2 0x0000562f85ae2a7d llvm::sys::CleanupOnSignal(unsigned long) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x2443a7d)

    ​3 0x0000562f85a6e9c3 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x23cf9c3)

    ​4 0x0000562f85a6eafc CrashRecoverySignalHandler(int) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x23cfafc)

    ​5 0x00007f3a99b560f0 __restore_rt (/usr/lib/libpthread.so.0+0x140f0)

    ​6 0x0000562f852e1221 (anonymous namespace)::MachineCSE::PerformCSE(llvm::DomTreeNodeBase*) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x1c42221)

    ​7 0x0000562f852e02db (anonymous namespace)::MachineCSE::runOnMachineFunction(llvm::MachineFunction&) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x1c412db)

    ​8 0x0000562f850af85d llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x1a1085d)

    ​9 0x0000562f854adff4 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x1e0eff4)

    ​10 0x0000562f854b4788 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x1e15788)

    ​11 0x0000562f854ae844 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x1e0f844)

    ​12 0x0000562f85cf97a5 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 >) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x265a7a5)

    ​13 0x0000562f868f6a9c clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x3257a9c)

    ​14 0x0000562f873567c3 clang::ParseAST(clang::Sema&, bool, bool) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x3cb77c3)

    ​15 0x0000562f862cdaf3 clang::FrontendAction::Execute() (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x2c2eaf3)

    ​16 0x0000562f86261903 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x2bc2903)

    ​17 0x0000562f8637b262 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x2cdc262)

    ​18 0x0000562f8441403f cc1_main(llvm::ArrayRef<char const>, char const, void*) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0xd7503f)

    ​19 0x0000562f8441211c ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0xd7311c)

    ​20 0x0000562f86126092 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, bool) const::$_1>(long) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x2a87092)

    ​21 0x0000562f85a6e8d7 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x23cf8d7)

    ​22 0x0000562f8612554d clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, bool) const (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x2a8654d)

    ​23 0x0000562f860f493b clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x2a5593b)

    ​24 0x0000562f860f4d27 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x2a55d27)

    ​25 0x0000562f8610c978 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0x2a6d978)

    ​26 0x0000562f84411ac3 main (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0xd72ac3)

    ​27 0x00007f3a995d1152 __libc_start_main (/usr/lib/libc.so.6+0x28152)

    ​28 0x0000562f8440ee8e _start (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin/clang+++0xd6fe8e)

    clang-10: error: clang frontend command failed due to signal (use -v to see invocation) clang version 10.0.0 (/home/gtoombs/.cache/yay/swift-language/llvm-project bcee1b98f3b26c5472985a07096f227d19e65f52) Target: i386-unknown-linux-gnu Thread model: posix InstalledDir: /home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/./bin 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_cpp-bd4d3b.cpp clang-10: note: diagnostic msg: /tmp/wrappers_cpp-bd4d3b.sh clang-10: note: diagnostic msg:


[1108/1351][ 82%][66.654s] Building CXX object lib/tsan/CMakeFiles/clang_rt.tsan-x86_64.dir/rtl/tsan_interceptors_posix.cpp.o ninja: build stopped: subcommand failed. FAILED: tools/clang/runtime/compiler-rt-stamps/compiler-rt-build cd /home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/tools/clang/runtime/compiler-rt-bins && /usr/bin/cmake --build . && /usr/bin/cmake -E touch /home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/tools/clang/runtime/compiler-rt-stamps//compiler-rt-build ninja: build stopped: subcommand failed. ERROR: command terminated with a non-zero exit status 1, aborting

ERROR: command terminated with a non-zero exit status 1, aborting

==> ERROR: A failure occurred in build(). Aborting... error making: swift-language

reinderien commented 3 years ago

Core dump core.clang-10.1000.acac670750964aaf94bf3fb7cfffcd81.160778.1610043753000000

reinderien commented 3 years ago

I can reliably reproduce a segfault when compiling that flags file:

$ "/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/bin/clang-10" \

"-cc1" \
"-triple" \
"i386-unknown-linux-gnu" \
"-emit-obj" \
"-disable-free" \
"-main-file-name" \
"flags.cpp" \
"-mrelocation-model" \
"static" \
"-mframe-pointer=all" \
"-fmath-errno" \
"-fno-rounding-math" \
"-mconstructor-aliases" \
"-fno-plt" \
"-ffreestanding" \
"-target-cpu" \
"x86-64" \
"-fno-split-dwarf-inlining" \
"-debugger-tuning=gdb" \
"-nostdinc++" \
"-skip-unused-modulemap-deps" \
"-sys-header-deps" \
"-D" \
"NDEBUG" \
"-D" \
"GWP_ASAN_HOOKS" \
"-O3" \
"-Wall" \
"-Wno-unused-parameter" \
"-Werror=conversion" \
"-Wall" \
"-Wno-elaborated-enum-base" \
"-std=c++14" \
"-fdeprecated-macro" \
"-ferror-limit" \
"19" \
"-fvisibility" \
"hidden" \
"-fgnuc-version=4.2.1" \
"-fcxx-exceptions" \
"-fexceptions" \
"-vectorize-loops" \
"-vectorize-slp" \
"-faddrsig" \
"-x" \
"c++" \
"/tmp/flags-02acbc.cpp"

PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script. Stack dump:

  1. Program arguments: /home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/bin/clang-10 -cc1 -triple i386-unknown-linux-gnu -emit-obj -disable-free -main-file-name flags.cpp -mrelocation-model static -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -fno-plt -ffreestanding -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -nostdinc++ -skip-unused-modulemap-deps -sys-header-deps -D NDEBUG -D GWP_ASAN_HOOKS -O3 -Wall -Wno-unused-parameter -Werror=conversion -Wall -Wno-elaborated-enum-base -std=c++14 -fdeprecated-macro -ferror-limit 19 -fvisibility hidden -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -vectorize-loops -vectorize-slp -faddrsig -x c++ /tmp/flags-02acbc.cpp
  2. parser at end of file
  3. Code generation
  4. Running pass 'Function Pass Manager' on module '/tmp/flags-02acbc.cpp'.
  5. Running pass 'Machine Common Subexpression Elimination' on function '@_ZN5scudo9initFlagsEv'

    ​0 0x000055d4a1e3a8d4 PrintStackTraceSignalHandler(void*) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/bin/clang-10+0x24448d4)

    ​1 0x000055d4a1e3849e llvm::sys::RunSignalHandlers() (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/bin/clang-10+0x244249e)

    ​2 0x000055d4a1e3abf5 SignalHandler(int) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/bin/clang-10+0x2444bf5)

    ​3 0x00007fe5cf5d50f0 __restore_rt (/usr/lib/libpthread.so.0+0x140f0)

    ​4 0x000055d4a1638221 (anonymous namespace)::MachineCSE::PerformCSE(llvm::DomTreeNodeBase*) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/bin/clang-10+0x1c42221)

    ​5 0x000055d4a16372db (anonymous namespace)::MachineCSE::runOnMachineFunction(llvm::MachineFunction&) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/bin/clang-10+0x1c412db)

    ​6 0x000055d4a140685d llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/bin/clang-10+0x1a1085d)

    ​7 0x000055d4a1804ff4 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/bin/clang-10+0x1e0eff4)

    ​8 0x000055d4a180b788 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/bin/clang-10+0x1e15788)

    ​9 0x000055d4a1805844 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/bin/clang-10+0x1e0f844)

    ​10 0x000055d4a20507a5 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 >) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/bin/clang-10+0x265a7a5)

    ​11 0x000055d4a2c4da9c clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/bin/clang-10+0x3257a9c)

    ​12 0x000055d4a36ad7c3 clang::ParseAST(clang::Sema&, bool, bool) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/bin/clang-10+0x3cb77c3)

    ​13 0x000055d4a2624af3 clang::FrontendAction::Execute() (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/bin/clang-10+0x2c2eaf3)

    ​14 0x000055d4a25b8903 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/bin/clang-10+0x2bc2903)

    ​15 0x000055d4a26d2262 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/bin/clang-10+0x2cdc262)

    ​16 0x000055d4a076b03f cc1_main(llvm::ArrayRef<char const>, char const, void*) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/bin/clang-10+0xd7503f)

    ​17 0x000055d4a076911c ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/bin/clang-10+0xd7311c)

    ​18 0x000055d4a0768e7b main (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/bin/clang-10+0xd72e7b)

    ​19 0x00007fe5cf050152 __libc_start_main (/usr/lib/libc.so.6+0x28152)

    ​20 0x000055d4a0765e8e _start (/home/gtoombs/.cache/yay/swift-language/src/build/buildbot_linux/llvm-linux-x86_64/bin/clang-10+0xd6fe8e)

    Segmentation fault (core dumped)