-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-introduce load-bearing assert, or fix niche debuginfo generation properly. #59509
Comments
I think DWARF LEB128 isn't technically bounded, but I'll bet a lot of tools will only decode 64-bit values. There's also But it looks like LLVM is limited: rust/src/librustc_codegen_llvm/debuginfo/metadata.rs Lines 1541 to 1545 in 2002b4b
rust/src/rustllvm/RustWrapper.cpp Lines 866 to 870 in 2002b4b
https://github.com/rust-lang/llvm-project/blob/1f484cbe0e863e9e215f1b3d7198063444d60873/llvm/include/llvm/IR/DIBuilder.h#L180-L181 We probably should at least be setting that |
Okay I was a bit confused, turns out there are two separate parts to this:
EDIT: updated the issue description, including the part of the IR showing the issue. |
Wouldn't it be better to just omit debuginfo when it can't be represented? |
Maybe, with a warning. |
rustc_codegen_llvm: support 128-bit discriminants in debuginfo. CC: rust-lang#59509 > Alternatively, if LLVM and DWARF support it, we should encode the 128-bit discriminant If we should fix like this issue comment, I'll do. r? @eddyb
rustc_codegen_llvm: support 128-bit discriminants in debuginfo. CC: rust-lang#59509 > Alternatively, if LLVM and DWARF support it, we should encode the 128-bit discriminant If we should fix like this issue comment, I'll do. r? @eddyb
Visited during wg-debugging triage. This assert exists today: rust/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/native.rs Lines 416 to 419 in 8006510
so I'm going to close this issue as completed and open a new issue specifically for tracking the removal of the assert. |
See #55701 (comment), this is just one-line addition for the assert.
Currently, this example:
has this in its LLVM IR (in debug mode):
Note the
extraData
, which indicates the discriminant (niche, in this case), it should be the same value asFoo::Bar
, plus1
, but is instead the truncated value (see below).The debuginfo for
Foo
is also wrong, but that is caused elsewhere in the codebase (in a spot where no assertion was ever added AFAIK. also see #59509 (comment)):The compiler should ICE, instead, to avoid generating the wrong debuginfo.
Alternatively, if LLVM and DWARF support it, we should encode the 128-bit discriminant, by employing
const_uint_big
instead ofconst_u64
here:rust/src/librustc_codegen_llvm/debuginfo/metadata.rs
Line 1817 in 237bf32
Also, this field would need to become
Option<u128>
:rust/src/librustc_codegen_llvm/debuginfo/metadata.rs
Line 924 in 237bf32
The text was updated successfully, but these errors were encountered: