Skip to content

LLVM debuginfo assertion "overlapping or duplicate fragments" #129206

Closed
@saethlin

Description

@saethlin

Original issue is below. As expected, this assertion can be hit without silly flags:

RUSTFLAGS="-Cpanic=abort -Cdebuginfo=2 -Cdebug-assertions=yes" cargo +master-stage1 install fd-find --force

Will eventually fail with

rustc: /checkout/src/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp:722: void llvm::DwarfExpression::addFragmentOffset(const DIExpression *): Assertion `FragmentOffset >= OffsetInBits && "overlapping or duplicate fragments"' failed.

This still requires a custom build and cannot be easily bisected because this requires a toolchain with LLVM assertions.

This assertion can also be reproduced with varying flags on the following crates:

fd-find ripgrep cargo-outdated cargo-audit cargo-deny bacon wthrr tokio-console josh cargo-lambda samply

I just tried using git bisect and the first few commits I tried to find a start point of my bisect don't build for various dumb reasons including missing books. I'm not going to fight with months-old bootstrap bugs.


I compile a toolchain locally and cargo install utilities with it, using some ridiculous flags intended to get more mileage out of assertions in the toolchain.

The compiler for this is built with:

./configure --set profile=compiler --set llvm.assertions=true --set llvm.download-ci-llvm=true --set rust.debug=true --set rust.incremental=false
RUSTFLAGS_NOT_BOOTSTRAP="-Zmir-opt-level=4 -Zmir-enable-passes=-DataflowConstProp -Zcross-crate-inline-threshold=yes" x build library

Then installing some crates with this will fail, the one I've been minimizing (yes really, this is somewhat minimized) the set of flags is tokei:

RUSTFLAGS="-Copt-level=1 -Zinline-mir -Zmir-opt-level=1 -Cdebuginfo=2 -Zcross-crate-inline-threshold=yes -Zinline-mir-hint-threshold=1000 -Zinline-mir-threshold=1000" cargo +master-stage1 install tokei --force --target=x86_64-unknown-linux-gnu

Compilation will eventually fail with this error:

rustc: /checkout/src/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp:722: void llvm::DwarfExpression::addFragmentOffset(const DIExpression *): Assertion `FragmentOffset >= OffsetInBits && "overlapping or duplicate fragments"' failed.

This is NOT caused by #128861. The assertion can be hit on the commit directly before that one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)C-bugCategory: This is a bug.E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcE-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions