This is an archive of the discontinued LLVM Phabricator instance.

Fix UB in DIExpression::appendOffset()
ClosedPublic

Authored by aprantl on Aug 18 2022, 6:41 PM.

Details

Summary

The absolute value of 0x8000000000000000 does not fit into an int64_t and UBSan tells us that by crashing.

rdar://98799670

Diff Detail

Event Timeline

aprantl created this revision.Aug 18 2022, 6:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 18 2022, 6:41 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
aprantl requested review of this revision.Aug 18 2022, 6:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 18 2022, 6:41 PM
aprantl updated this revision to Diff 453858.Aug 18 2022, 6:43 PM
aprantl updated this revision to Diff 453860.Aug 18 2022, 6:53 PM
dblaikie accepted this revision.Aug 18 2022, 8:21 PM
dblaikie added a subscriber: dblaikie.

SGTM

This revision is now accepted and ready to land.Aug 18 2022, 8:21 PM
JDevlieghere added inline comments.
llvm/test/DebugInfo/salvage-overflow.ll
4
djtodoro added inline comments.
llvm/lib/IR/DebugInfoMetadata.cpp
1388

was else dropped intentionally?

Orlando added inline comments.
llvm/lib/IR/DebugInfoMetadata.cpp
1388

nit: the else appears to have gone missing

aprantl added inline comments.Aug 19 2022, 9:13 AM
llvm/lib/IR/DebugInfoMetadata.cpp
1388

whoops, thanks!

This revision was landed with ongoing or failed builds.Aug 19 2022, 9:17 AM
This revision was automatically updated to reflect the committed changes.
dblaikie added inline comments.Aug 19 2022, 10:22 AM
llvm/lib/IR/DebugInfoMetadata.cpp
1388

ooh, that might be worth implementing a warning for that at some point, like misleading indentation, etc.