This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add bounds check before use on returned iterator.
AbandonedPublic

Authored by anmolparalkar-nxp on Aug 8 2023, 6:46 PM.

Details

Summary

Check iterator validity before use; fixes crash seen when compiling internal benchmark.

Diff Detail

Unit TestsFailed

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptAug 8 2023, 6:47 PM
anmolparalkar-nxp requested review of this revision.Aug 8 2023, 6:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 8 2023, 6:47 PM
BRANCH: release/17.x
SHA: d6417ad67d9425f7cd8eb2a606f66d7da2aecd4d
anmolparalkar-nxp edited the summary of this revision. (Show Details)Aug 8 2023, 7:00 PM
wangpc added a comment.Aug 8 2023, 7:59 PM

Can you add the crashed case too?
(And please use llvm-reduce to reduce the case)

asb accepted this revision.Aug 9 2023, 3:53 AM

Fix LGTM. I think it makes some sense to see if a simple test case can be produced as @wangpc suggests - I don't think that's always the case when there's a missing check (as test cases might end up being very specific to the current implementation approach), but it does feel like the fact you encountered this error indicates we don't have enough in-tree testing for this.

This revision is now accepted and ready to land.Aug 9 2023, 3:53 AM