Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upDebuginfo generation is broken with LLVM 3.8 #36774
Comments
nagisa
changed the title
Debuginfo generation is broken in LLVM 3.8
Debuginfo generation is broken with LLVM 3.8
Sep 27, 2016
sanxiyn
added
the
A-debuginfo
label
Sep 28, 2016
This comment has been minimized.
This comment has been minimized.
|
This is a regression-from-stable-to-nightly (-beta in a few days) and and I-ICE. |
This comment has been minimized.
This comment has been minimized.
|
I'm not sure which stable you meant, but I'm seeing this regression on stable 1.12 while building git2 for cargo, while compiling the same with 1.11 is fine. Here's the excerpt from Fedora's full build.log:
|
This comment has been minimized.
This comment has been minimized.
|
I can also reproduce this compiling |
This comment has been minimized.
This comment has been minimized.
akien-mga
commented
Oct 3, 2016
|
I can confirm the error reported by @cuviper on Mageia too, using Rust 1.12.0 and LLVM 3.8.1, on both x86_64 and i586. The rust and cargo packaging in Mageia are otherwise synced with Fedora. Full build log on x86_64. |
This comment has been minimized.
This comment has been minimized.
|
I also just confirmed that 1.12 with |
cuviper
referenced this issue
Oct 4, 2016
Closed
1.12.0: High memory usage when linking in release mode with debug info #36926
nikomatsakis
added
regression-from-stable-to-beta
A-mir
labels
Oct 4, 2016
This comment has been minimized.
This comment has been minimized.
|
Tagging as regression. cc @rust-lang/compiler |
This comment has been minimized.
This comment has been minimized.
|
Bisecting from LLVM 3.8 to LLVM 3.9 led to r267296. That is, r267295 errors, and r267296 does not. |
brson
added
T-compiler
I-crash
labels
Oct 6, 2016
This comment has been minimized.
This comment has been minimized.
|
Thanks for bisecting @sanxiyn |
brson
added
the
I-nominated
label
Oct 6, 2016
This comment has been minimized.
This comment has been minimized.
|
Compiler team please triage. |
This comment has been minimized.
This comment has been minimized.
|
Backporting an LLVM patch is not an option, as we do not control that LLVM 3.8 which distributions use. Seems to me like there’s exactly two viable fixes:
|
This comment has been minimized.
This comment has been minimized.
|
Do we know what we would have to do in order to be "3.8-compatible"? |
This comment has been minimized.
This comment has been minimized.
|
FWIW, I've been asked many times if Fedora will keep up to date with the latest Rust, presumably by people who really want that. If we suddenly require LLVM 3.9, this is a serious roadblock to upgrades. Even Fedora Rawhide has not updated LLVM yet! A backported LLVM patch is possible -- if we know it fixes the problem, I can ask our LLVM maintainers to apply it. However, if I'm not mistaken that patch is modifying a couple public headers, which is bad for API compatibility and probably signals ABI changes too. A backport would have to mitigate that. If it's possible for rustc/rustllvm/whatever to make a change for 3.8-compatibility, I'd be much happier backporting that to our rust package. |
This comment has been minimized.
This comment has been minimized.
|
triage: P-high assigning to @michaelwoerister to investigate a bit more what is happening here. |
rust-highfive
added
P-high
and removed
I-nominated
labels
Oct 6, 2016
nikomatsakis
assigned
michaelwoerister
Oct 6, 2016
This comment has been minimized.
This comment has been minimized.
|
Reduced test case to 60 lines: https://gist.github.com/sanxiyn/b1d666f132d3314cd999bb9b629acc2b |
This comment has been minimized.
This comment has been minimized.
|
@sanxiyn Thank you so much for the reduction! That will be very helpful. |
This comment has been minimized.
This comment has been minimized.
|
So, I've been able to reproduce this (thanks again, @sanxiyn) but I cannot find any real difference in the debuginfo produced by the working and by the failing versions of LLVM. Type sizes and alignments and field offsets seem to be correct, and they are the same in both versions. |
This comment has been minimized.
This comment has been minimized.
|
I'm gonna give rustc 1.11 a try. |
This comment has been minimized.
This comment has been minimized.
|
Alright, bisecting Rust between 1.11 and 1.12 has revealed that PR #35197 somehow breaks LLVM 3.8. I don't have a clue as to why that is. Any idea, @eddyb? For reference: I bisected by building Rust against LLVM 3.8.0 and checking whether it could build Cargo with debuginfo+optimizations (Cargo is the project for which building fails in the logs provided above by @cuviper). |
This comment has been minimized.
This comment has been minimized.
|
@michaelwoerister For the record, that PR is where MIR trans was turned on. So you'll want to go back further and add |
This comment has been minimized.
This comment has been minimized.
|
@michaelwoerister I'm a little confused, because even base 1.11 fails for me when using |
This comment has been minimized.
This comment has been minimized.
|
I thought mir-trans was already enabled in #34096? That PR still passes just fine. |
This comment has been minimized.
This comment has been minimized.
|
@michaelwoerister #34096 has absolutely no effect for cross-crate MIR because someone broke it. |
This comment has been minimized.
This comment has been minimized.
|
@eddyb Can you elaborate? Do you mean that inlined functions were still translated with old-trans by default? |
This comment has been minimized.
This comment has been minimized.
|
@michaelwoerister Not just by default, the compiler simply couldn't inline MIR cross-crate because the |
This comment has been minimized.
This comment has been minimized.
|
@eddyb So translation fell back to old-trans when it didn't find the MIR in the extern crate? |
This comment has been minimized.
This comment has been minimized.
|
@michaelwoerister Right, it never found the MIR cross-crate so it used old trans (like |
This comment has been minimized.
This comment has been minimized.
|
So, it's possible that neither MIR-trans nor old-trans never actually worked reliably with LLVM 3.8 with debuginfo+optimizations enabled and MIR-trans is just more likely to run into this bug, right? At least I have no indication so far, that MIR trans generates different or faulty debuginfo. It might just generate code that is more amenable to SROA or something. |
This comment has been minimized.
This comment has been minimized.
|
I can't comment on likelihood, but anecdotally I've never seen this issue without MIR. I just tried even older
Whereas 1.9.0 finally fails differently and ICEs on git2:
1.9 also errors on rustc-serialize:
|
This comment has been minimized.
This comment has been minimized.
|
Hmm, external LLVM may be a red herring. I just tried with nightly and got a similar error, though it came from a different place.
|
This comment has been minimized.
This comment has been minimized.
|
See also: #35547 |
cuviper
referenced this issue
Oct 13, 2016
Closed
LLVM error and build failure: "piece covers entire variable" #35547
michaelwoerister
referenced this issue
Oct 13, 2016
Merged
debuginfo: Handle spread_arg case in MIR-trans in a more stable way. #37153
This comment has been minimized.
This comment has been minimized.
|
Update: #37153 should help with at least some of these cases, maybe all. I've also filed a bug report with LLVM: https://llvm.org/bugs/show_bug.cgi?id=30703 Also note, that if you don't need full debuginfo, just line tables for profiling and backtraces, then compiling with "-Cdebuginfo=1" is sufficient and will prevent these assertions from being triggered. |
bors
added a commit
that referenced
this issue
Oct 16, 2016
bors
added a commit
that referenced
this issue
Oct 16, 2016
bors
added a commit
that referenced
this issue
Oct 17, 2016
This comment has been minimized.
This comment has been minimized.
|
Thanks @michaelwoerister! Waiting on backport. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Yes, I thought so too. The code in the two PRs looks correct. |
This comment has been minimized.
This comment has been minimized.
|
PR #37315 seems to run into something like this, after the partial fix. (Note: It was triggered by the flat_map part linked here, the PR was since updated to remove it): piece is larger than or outside of variable
tail call void @llvm.dbg.value(metadata %"ty::FieldDefData"* %2, i64 0, metadata !105417, metadata !6823), !dbg !105421
!105417 = !DILocalVariable(arg: 3, scope: !105386, file: !15, line: 1, type: !105406)
!6823 = !DIExpression(DW_OP_bit_piece, 64, 64)
LLVM ERROR: Broken function found, compilation aborted!The line inside librustc that produced the assertion was here, where |
This comment has been minimized.
This comment has been minimized.
|
@bluss |
This comment has been minimized.
This comment has been minimized.
|
The issue reported by @bluss in the comment above seems to happen on our in-tree LLVM (our buildbots). Would be good to try minimise the reproduction and see if it also happens on external LLVM first. |
This comment has been minimized.
This comment has been minimized.
|
@nagisa I didn't even know where to begin minimizing it, since it was triggered by code in librustc, a pretty large crate. |
This comment has been minimized.
This comment has been minimized.
|
Does that suggest that the issue reported by @bluss is a separate issue? |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis That seems about right. I also feel that the issue reported by @bluss might not be just a regression, but a genuine bug. Either way, a good idea would be to fill a new issue and try to reproduce what @bluss saw. Other than that I can confirm that bootstrapping rustc with LLVM 3.8 does not ICE anymore, so we’re good in that regard. |
This comment has been minimized.
This comment has been minimized.
|
@bluss Would you mind opening a new issue for the problem you discovered? You can copy your comment from above, that is informative enough. Closing this issue since the original problem has been solved. |
michaelwoerister
closed this
Nov 7, 2016
This comment has been minimized.
This comment has been minimized.
|
New issue is #37633 |
This comment has been minimized.
This comment has been minimized.
|
Thank you, @bluss! |
nagisa commentedSep 27, 2016
•
edited
Compiling librustc_mir with optimisations on and debuginfo enabled fails with LLVM assertion:
The failure started happening sometime in the past month. Any change related to how we generate debuginfo for variables is a suspect as it likely specifies the size of the variable incorrectly (as per https://llvm.org/bugs/show_bug.cgi?id=23712)
Works fine with LLVM bundled with rust.