This is an archive of the discontinued LLVM Phabricator instance.

[ADT] Assert that SmallVectorBase::grow_pod() successfully reallocates memory.
ClosedPublic

Authored by dsanders on May 6 2015, 3:55 AM.

Details

Summary

If malloc/realloc fails then the SmallVector becomes unusable since begin() and
end() will return NULL. This is unlikely to occur but was the cause of recent
bugpoint test failures on my machine.

It is not clear whether not checking for malloc/realloc failure is a deliberate
decision and adding checks has the potential to impact compiler performance.
Therefore, this patch only adds the check to builds with assertions enabled for
the moment.

Diff Detail

Event Timeline

dsanders updated this revision to Diff 25030.May 6 2015, 3:55 AM
dsanders retitled this revision from to [ADT] Assert that SmallVectorBase::grow_pod() successfully reallocates memory..
dsanders updated this object.
dsanders edited the test plan for this revision. (Show Details)
dsanders added a subscriber: Unknown Object (MLST).
bkramer accepted this revision.Jun 3 2015, 6:21 AM
bkramer added a reviewer: bkramer.
bkramer added a subscriber: bkramer.

Looks good. We'll probably need better error reporting for OOM some day but for now an assert is fine.

This revision is now accepted and ready to land.Jun 3 2015, 6:21 AM
dsanders closed this revision.Jun 9 2015, 2:51 AM