This is an archive of the discontinued LLVM Phabricator instance.

[clang][dataflow] Fix a null pointer crash in `computeBlockInputState()`.
ClosedPublic

Authored by mboehme on May 22 2023, 2:52 AM.

Details

Summary

The crash was due to unconditionally calling
Block.succ_begin()->getReachableBlock()->hasNoReturnElement(), but
getReachableBlock() can return null now that we have turned
PruneTriviallyFalseEdges on.

This patch adds two tests that crash without the fix.

Diff Detail

Event Timeline

mboehme created this revision.May 22 2023, 2:52 AM
Herald added a project: Restricted Project. · View Herald Transcript
mboehme requested review of this revision.May 22 2023, 2:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 22 2023, 2:52 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
ymandel accepted this revision.May 22 2023, 5:04 AM
ymandel added inline comments.
clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
218–221

Nit.

This revision is now accepted and ready to land.May 22 2023, 5:04 AM