This is an archive of the discontinued LLVM Phabricator instance.

[CodeView] Avoid NULL deref of Scope
ClosedPublic

Authored by glandium on Sep 25 2022, 2:47 PM.

Details

Summary

Regression from D131400: cross-language LTO causes a crash in the
compiler on the NULL deref of Scope in isa call when Rust IR is
involved. Presumably, this might affect other languages too, and
even Rust itself without cross-language LTO when the Rust compiler
switched to LLVM 16.

Diff Detail

Event Timeline

glandium created this revision.Sep 25 2022, 2:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 25 2022, 2:47 PM
glandium requested review of this revision.Sep 25 2022, 2:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 25 2022, 2:47 PM
rnk added a comment.Oct 3 2022, 3:43 PM

Code looks good, but can you add a globals-rust.ll file next to llvm/test/DebugInfo/COFF/global_visibility.ll with some representative debug info? Or limit it to globals-noscope.ll or something like that to hit this codepath.

glandium updated this revision to Diff 465916.Oct 6 2022, 4:01 PM

Adding a testcase that crashes without the patch and passes with the patch.

rnk accepted this revision.Oct 6 2022, 4:02 PM

lgtm

This revision is now accepted and ready to land.Oct 6 2022, 4:02 PM

Thank you. Could you publish this for me (I don't have commit access)?

This revision was automatically updated to reflect the committed changes.