Skip to content

Segfault in 1.48.0 while release-building with pango crate with target-cpu=native #79564

Closed
@twistedfall

Description

@twistedfall

Hello!

I'm observing a compilation regression coming from 1.47 to 1.48. Just an empty project with only a pango = "=0.9.1" dependency segfaults when building it with:

$ RUSTFLAGS="-Ctarget-cpu=native" cargo build --release
...
error: could not compile `pango`

Caused by:
  process didn't exit successfully: `rustc --crate-name pango /home/pro/.local/share//cargo/registry/src/github.com-1ecc6299db9ec823/pango-0.9.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C metadata=73a5fd5a2732e879 -C extra-filename=-73a5fd5a2732e879 --out-dir /home/pro/projects/pango-segfault/target/release/deps -L dependency=/home/pro/projects/pango-segfault/target/release/deps --extern bitflags=/home/pro/projects/pango-segfault/target/release/deps/libbitflags-7a5a028b90466088.rmeta --extern glib=/home/pro/projects/pango-segfault/target/release/deps/libglib-eb19bb9ed10d3c8a.rmeta --extern glib_sys=/home/pro/projects/pango-segfault/target/release/deps/libglib_sys-6a221d5a3b5ccbd7.rmeta --extern gobject_sys=/home/pro/projects/pango-segfault/target/release/deps/libgobject_sys-11ec2826f577d709.rmeta --extern libc=/home/pro/projects/pango-segfault/target/release/deps/liblibc-39cee2923afccfe9.rmeta --extern once_cell=/home/pro/projects/pango-segfault/target/release/deps/libonce_cell-bc4f5cf8a22a6966.rmeta --extern pango_sys=/home/pro/projects/pango-segfault/target/release/deps/libpango_sys-61dc8a50154ebf0b.rmeta --cap-lints allow -Ctarget-cpu=native` (signal: 11, SIGSEGV: invalid memory reference)

System logs:

[21353.932383] rustc[41862]: segfault at 7fdc0000000f ip 00007fdbc15960e6 sp 00007fdbae3fabb0 error 4 in librustc_driver-b0fbf3475685dbff.so[7fdbc06d6000+7ce8000]
[21353.932391] Code: 01 42 8d 34 28 83 c6 01 44 89 fa c1 e2 04 bf 50 00 00 00 e8 2c 8f dc 01 49 89 c6 48 89 5c 24 28 4c 89 7c 24 30 48 8b 44 24 10 <48> 8b 40 10 48 8b 30 4c 89 ea 4d 85 ff 74 47 49 6b c7 38 31 c9 31

GDB backtrace:

#0  0x00007fdbc15960e6 in llvm::CallInst::Create(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, llvm::Twine const&, llvm::Instruction*) ()
   from /home/pro/.config/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-b0fbf3475685dbff.so
#1  0x00007fdbc1723479 in llvm::IRBuilderBase::CreateCall(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::Twine const&, llvm::MDNode*) ()
   from /home/pro/.config/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-b0fbf3475685dbff.so
#2  0x00007fdbc32f2fd3 in llvm::IRBuilderBase::CreateMaskedGather(llvm::Value*, llvm::Align, llvm::Value*, llvm::Value*, llvm::Twine const&) ()
   from /home/pro/.config/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-b0fbf3475685dbff.so
#3  0x00007fdbc1f92c01 in llvm::InnerLoopVectorizer::vectorizeMemoryInstruction(llvm::Instruction*, llvm::VPTransformState&, llvm::VPValue*, llvm::VPValue*, llvm::VPValue*) ()
   from /home/pro/.config/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-b0fbf3475685dbff.so
#4  0x00007fdbc1ff40e4 in llvm::VPBasicBlock::execute(llvm::VPTransformState*) () from /home/pro/.config/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-b0fbf3475685dbff.so
#5  0x00007fdbc1ff52cd in llvm::VPlan::execute(llvm::VPTransformState*) () from /home/pro/.config/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-b0fbf3475685dbff.so
#6  0x00007fdbc1fad3ae in llvm::LoopVectorizationPlanner::executePlan(llvm::InnerLoopVectorizer&, llvm::DominatorTree*) () from /home/pro/.config/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-b0fbf3475685dbff.so
#7  0x00007fdbc1fb67cc in llvm::LoopVectorizePass::processLoop(llvm::Loop*) () from /home/pro/.config/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-b0fbf3475685dbff.so
#8  0x00007fdbc1fb7f87 in llvm::LoopVectorizePass::runImpl(llvm::Function&, llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::TargetTransformInfo&, llvm::DominatorTree&, llvm::BlockFrequencyInfo&, llvm::TargetLibraryInfo*, llvm::DemandedBits&, llvm::AAResults&, llvm::AssumptionCache&, std::function<llvm::LoopAccessInfo const& (llvm::Loop&)>&, llvm::OptimizationRemarkEmitter&, llvm::ProfileSummaryInfo*) ()
   from /home/pro/.config/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-b0fbf3475685dbff.so
#9  0x00007fdbc1fbb7ae in (anonymous namespace)::LoopVectorize::runOnFunction(llvm::Function&) () from /home/pro/.config/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-b0fbf3475685dbff.so
#10 0x00007fdbc331df16 in llvm::FPPassManager::runOnFunction(llvm::Function&) () from /home/pro/.config/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-b0fbf3475685dbff.so
#11 0x00007fdbc3323893 in llvm::FPPassManager::runOnModule(llvm::Module&) () from /home/pro/.config/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-b0fbf3475685dbff.so
#12 0x00007fdbc331e6f8 in llvm::legacy::PassManagerImpl::run(llvm::Module&) () from /home/pro/.config/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-b0fbf3475685dbff.so
#13 0x00007fdbc329e216 in LLVMRunPassManager () from /home/pro/.config/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-b0fbf3475685dbff.so
#14 0x00007fdbc1541248 in rustc_codegen_llvm::back::lto::run_pass_manager () from /home/pro/.config/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-b0fbf3475685dbff.so
#15 0x00007fdbc1542425 in rustc_codegen_llvm::back::lto::optimize_thin_module () from /home/pro/.config/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-b0fbf3475685dbff.so
#16 0x00007fdbc1440c4c in rustc_codegen_ssa::back::lto::LtoModuleCodegen<B>::optimize () from /home/pro/.config/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-b0fbf3475685dbff.so
#17 0x00007fdbc14ded72 in rustc_codegen_ssa::back::write::execute_work_item () from /home/pro/.config/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-b0fbf3475685dbff.so
#18 0x00007fdbc13c5dbf in std::sys_common::backtrace::__rust_begin_short_backtrace () from /home/pro/.config/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-b0fbf3475685dbff.so
#19 0x00007fdbc1444665 in core::ops::function::FnOnce::call_once{{vtable-shim}} () from /home/pro/.config/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-b0fbf3475685dbff.so
#20 0x00007fdbc04096fa in alloc::boxed::{{impl}}::call_once<(),FnOnce<()>> () at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/boxed.rs:1042
#21 alloc::boxed::{{impl}}::call_once<(),alloc::boxed::Box<FnOnce<()>>> () at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/boxed.rs:1042
#22 std::sys::unix::thread::{{impl}}::new::thread_start () at library/std/src/sys/unix/thread.rs:87
#23 0x00007fdbc02efece in start_thread () from /lib64/libpthread.so.0
#24 0x00007fdbc022356f in clone () from /lib64/libc.so.6

Versions 1.49.0-beta.2 (bd26e4e54 2020-11-24) and 1.50.0-nightly (1c389ffef 2020-11-24) also have this issue. Without these RUSTFLAGS it builds fine, it also builds fine when I build in debug mode. No problems at all when building that project on version 1.47.0.

My system info:

$ uname -a
Linux razor 5.10.0-rc6 #2 SMP Mon Nov 30 09:32:07 CET 2020 x86_64 Intel(R) Core(TM) i9-10885H CPU @ 2.40GHz GenuineIntel GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions