Skip to content

Setting opt-level = 3 will cause stage1-rustc to segfault on Linux #52378

Closed

Description

@kennytm

Stack trace:

#0  0x00007f9fc5fe6a11 in llvm::scc_iterator<llvm::CallGraph*, llvm::GraphTraits<llvm::CallGraph*> >::DFSVisitOne(llvm::CallGraphNode*) ()
   from ./checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#0  0x00007f9fc5fe6a11 in llvm::scc_iterator<llvm::CallGraph*, llvm::GraphTraits<llvm::CallGraph*> >::DFSVisitOne(llvm::CallGraphNode*) ()
   from ./checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#1  0x00007f9fc6f295b1 in (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) ()
   from ./checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#2  0x00007f9fc7289f0c in llvm::legacy::PassManagerImpl::run(llvm::Module&) ()
   from ./checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#3  0x00007f9fc720c829 in LLVMRunPassManager ()
   from ./checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#4  0x00007f9fc5681fe7 in rustc_codegen_llvm::back::write::execute_work_item::hfd3cb98239864c6b ()
   from ./checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#5  0x00007f9fc56343a3 in std::sys_common::backtrace::__rust_begin_short_backtrace::h8c37409cc6efa4b9 ()
   from ./checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#6  0x00007f9fc5658096 in std::panicking::try::do_call::h3fbe882ce88a0178 ()
   from ./checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#7  0x00007f9fcfc0942a in __rust_maybe_catch_panic ()
    at libpanic_unwind/lib.rs:106
#8  0x00007f9fc5641ad1 in _$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$::call_box::hcd99e38bedf3313c ()
   from ./checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#9  0x00007f9fcfbc13bb in call_once<(),()> ()
    at /checkout/src/liballoc/boxed.rs:650
#10 std::sys_common::thread::start_thread::hf91e8d5f6a6b3cf0 ()
    at libstd/sys_common/thread.rs:24
#11 0x00007f9fcfbc6bf6 in std::sys::unix::thread::Thread::new::thread_start::h3a956f4a27a51528 () at libstd/sys/unix/thread.rs:90
#12 0x00007f9fc9d196ba in ?? ()
#13 0x0000000000000000 in ?? ()

Examples:

Activity

  1. added
    A-spuriousArea: Spurious failures in builds (spuriously == for no apparent reason)
    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    C-bugCategory: This is a bug.
    on Jul 14, 2018
  2. kennytm commented on Jul 14, 2018

    @kennytm
    MemberAuthor

    In #52326 (comment) we build with LLVM assertions enabled, but there is no messages from the log, meaning the segfault is not caused by broken assertions.

  3. added a commit that references this issue on Jul 14, 2018
  4. alexcrichton commented on Jul 14, 2018

    @alexcrichton
    Member

    When setting opt-level=3 I believe that also changes the C/C++ code's optimization level, so this may be a but in clang's O3 optimization passes as well (and may in theory be fixable by compiling C++ code with O2)

  5. mati865 commented on Sep 19, 2019

    @mati865
    Member

    When setting opt-level=3 I believe that also changes the C/C++ code's optimization level

    I inspected generated CMake files and LLVM is built with -O3 nowadays but Rust is still using opt-level=2.

    How can I see if reapplying opt-level=3 works without possibly breaking CI?

  6. added a commit that references this issue on Jan 31, 2020
    138c50f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-spuriousArea: Spurious failures in builds (spuriously == for no apparent reason)C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions