This is an archive of the discontinued LLVM Phabricator instance.

[IR] Handle large element size when calculating GEP indices
ClosedPublic

Authored by nikic on Sep 24 2021, 11:48 AM.

Details

Summary

This is a fix for the issue reported at https://reviews.llvm.org/D110043#3019942. The ElementSize is a uint64_t and as such may be larger than the index space, or be negative in the index space. This is UB, but shouldn't cause assertion failures.

We address this by detecting whether the size is too large and use a zero index in that case.

Diff Detail

Event Timeline

nikic created this revision.Sep 24 2021, 11:48 AM
nikic requested review of this revision.Sep 24 2021, 11:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 24 2021, 11:48 AM
aeubanks accepted this revision.Sep 24 2021, 12:52 PM
This revision is now accepted and ready to land.Sep 24 2021, 12:52 PM
This revision was landed with ongoing or failed builds.Sep 24 2021, 1:20 PM
This revision was automatically updated to reflect the committed changes.