Skip to content

MIR inlining does not handle SourceScopeLocalData #66137

Closed
@Aaron1011

Description

@Aaron1011
Member

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.

Activity

changed the title [-]MIR inlinging does not handle `SourceScopeLocalData`[/-] [+]MIR inlining does not handle `SourceScopeLocalData`[/+] on Nov 5, 2019
added
A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html
C-bugCategory: This is a bug.
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Nov 5, 2019
added
A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)
on Nov 6, 2019
added
E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
on Nov 6, 2019
eddyb

eddyb commented on Nov 6, 2019

@eddyb
Member

Sounds like a simple enough omission, but I'm surprised this doesn't break any of our mir-opt tests.

Aaron1011

Aaron1011 commented on Nov 6, 2019

@Aaron1011
MemberAuthor

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

Dylan-DPC-zz commented on Nov 13, 2019

@Dylan-DPC-zz
added a commit that references this issue on Nov 13, 2019
dadd817
eddyb

eddyb commented on Nov 13, 2019

@eddyb
Member

@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. change SourceScopeData to contain a ClearCrossCrate<SourceScopeLocalData> - I don't think the size of SourceScopeData is critical (but we should run perf anyway).

Aaron1011

Aaron1011 commented on Nov 14, 2019

@Aaron1011
MemberAuthor

@eddyb: SourceScopeData doesn't contain SourceScopeLocalData. Your change would require wrapping both fields of SourceScopeLocalData in ClearCrossCrate, since SourceScopeLocalData is stored in an IndexVec in Body.source_scope_local_data

Aaron1011

Aaron1011 commented on Nov 14, 2019

@Aaron1011
MemberAuthor

Oops, I misread your proposal - you were talking about changing SourceScopeData to contain a SourceScopeLocalData. I'll try that.

oli-obk

oli-obk commented on Dec 29, 2019

@oli-obk
Contributor

This was fixed in #66789 as far as I can tell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)C-bugCategory: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @eddyb@RalfJung@oli-obk@Aaron1011@jonas-schievink

    Issue actions

      MIR inlining does not handle `SourceScopeLocalData` · Issue #66137 · rust-lang/rust