Closed
Description
During the MIR inlining pass, we add scopes from the callee to Body.source_scopes
in the caller. However, we do not update source_scope_local_data
, which causes any inlined scopes to have no entry in the caller source_scope_local_data
. This causes an ICE in Miri when we try to generate a stacktrace - however, the ICE occurs in rustc code, so it's possible that we might run across this without Miri.
Metadata
Metadata
Assignees
Labels
Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: Debugging information in compiled programs (DWARF, PDB, etc.)Category: This is a bug.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Activity
[-]MIR inlinging does not handle `SourceScopeLocalData`[/-][+]MIR inlining does not handle `SourceScopeLocalData`[/+]eddyb commentedon Nov 6, 2019
Sounds like a simple enough omission, but I'm surprised this doesn't break any of our
mir-opt
tests.Aaron1011 commentedon Nov 6, 2019
I don't think this is
E-Easy
-source_scope_local_data
is crate local, and it's not immediately obvious to me what the correct beehvaior is for cross-crate inlining.Dylan-DPC-zz commentedon Nov 13, 2019
@rustbot assign @Aaron1011
Fix generating CTFE backtrace on optimized MIR
eddyb commentedon Nov 13, 2019
@Aaron1011 Oh, I thought the concern was entirely about same-crate, sorry!
I think the fix in that case is to move the
ClearCrossCrate
inward, i.e. changeSourceScopeData
to contain aClearCrossCrate<SourceScopeLocalData>
- I don't think the size ofSourceScopeData
is critical (but we should run perf anyway).Aaron1011 commentedon Nov 14, 2019
@eddyb:
SourceScopeData
doesn't containSourceScopeLocalData
. Your change would require wrapping both fields ofSourceScopeLocalData
inClearCrossCrate
, sinceSourceScopeLocalData
is stored in anIndexVec
inBody.source_scope_local_data
Aaron1011 commentedon Nov 14, 2019
Oops, I misread your proposal - you were talking about changing
SourceScopeData
to contain aSourceScopeLocalData
. I'll try that.oli-obk commentedon Dec 29, 2019
This was fixed in #66789 as far as I can tell