This is an archive of the discontinued LLVM Phabricator instance.

Fix unix.Malloc analysis crasher when allocating dynamic arrays w/unbound statements (fix PR32050)
AbandonedPublic

Authored by kmarshall on Feb 23 2017, 2:42 PM.

Details

Reviewers
cfe-commits
Summary

The extent calculation function had a bug which caused it to ignore if the size value was defined prior to casting it. As a result, size expressions with free variables would trigger assertion failures during the cast operation.

This patch adds that missing check, and replaces the redundant call to castAs<>() with the SVar that is returned by the checked cast.

Added a regression test "Malloc+NewDynamicArray" that exercises the fix.

Diff Detail

Event Timeline

kmarshall created this revision.Feb 23 2017, 2:42 PM
kmarshall abandoned this revision.Mar 10 2017, 2:56 PM