Page MenuHomePhabricator

[CGP] Fix a crash when "Result" is a nullptr.
AbandonedPublic

Authored by joey on May 13 2014, 8:07 AM.

Details

Reviewers
joey
Summary

r205941 changed the logic, so that a cast happens *before* 'Result' is compared to 'AddrMode.BaseReg'.
In the case that 'AddrMode.BaseReg' is nullptr, 'Result' will also be nullptr, so the cast causes an assertion.
We should use dyn_cast_or_null here to check 'Result' is not null and it is an instruction.

Bug found by Mats Petersson, and I reduced his IR to get a test case.

Also r205941 didn't have a test case, so it'd be good to get one for that commit too.

Diff Detail

Event Timeline

joey updated this revision to Diff 9353.May 13 2014, 8:07 AM
joey retitled this revision from to [CGP] Fix a crash when "Result" is a nullptr..
joey updated this object.
joey edited the test plan for this revision. (Show Details)
joey added a subscriber: Unknown Object (MLST).
joey accepted this revision.May 13 2014, 8:50 AM
joey added a reviewer: joey.
This revision is now accepted and ready to land.May 13 2014, 8:50 AM
joey abandoned this revision.May 13 2014, 8:50 AM

Thanks Chandler, r208705!