This is an archive of the discontinued LLVM Phabricator instance.

Fix for PR20110: Don't assume that the subexpression of a bit cast has pointer type if the bit cast has pointer type
ClosedPublic

Authored by rtrieu on Jun 24 2014, 3:13 PM.

Details

Summary

When a bit cast expression has pointer type, don't assume that the subexpression also has pointer type. It is possible that the subexpression is a value type instead. This patch checks the type of the subexpression and calls the proper function. Prevents the assertion failure reported in PR20110.

http://llvm.org/bugs/show_bug.cgi?id=20110

Diff Detail

Event Timeline

rtrieu updated this revision to Diff 10806.Jun 24 2014, 3:13 PM
rtrieu retitled this revision from to Fix for PR20110: Don't assume that the subexpression of a bit cast has pointer type if the bit cast has pointer type.
rtrieu updated this object.
rtrieu edited the test plan for this revision. (Show Details)
rtrieu added a subscriber: Unknown Object (MLST).
rtrieu updated this revision to Diff 10989.Jun 30 2014, 7:32 PM

Have the bit cast return a null pointer if the sub expression is not a pointer. Also note in the test that the template definitions should produce an error in C++11 mode.

rsmith accepted this revision.Jul 1 2014, 6:11 PM
rsmith added a reviewer: rsmith.
rsmith added a subscriber: rsmith.

LGTM

This revision is now accepted and ready to land.Jul 1 2014, 6:11 PM
rtrieu closed this revision.Jul 1 2014, 9:48 PM
rtrieu updated this revision to Diff 11018.

Closed by commit rL212160 (authored by @rtrieu).