This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Don't crash on array types with incomplete element type whose bound results in overflow
Needs ReviewPublic

Authored by majnemer on Apr 10 2015, 1:02 AM.

Details

Reviewers
rsmith
Summary

We can't be sure that an array is too large without knowing how large
array elements are.

Diff Detail

Event Timeline

majnemer updated this revision to Diff 23580.Apr 10 2015, 1:02 AM
majnemer retitled this revision from to [Sema] Don't crash on array types with incomplete element type whose bound results in overflow.
majnemer updated this object.
majnemer added a reviewer: rsmith.
majnemer added a subscriber: Unknown Object (MLST).
rsmith edited edge metadata.Apr 17 2015, 6:46 PM

It's awkward to be rewriting chunks of Sema::BuildArrayType here. Would it be possible to factor out the "check for negative bound and array too large, and build a constant array type" part and use it in both places? The callers of TryToFixInvalidVariablyModifiedType all apparently want to diagnose those failure conditions in the same way (except that CheckVariableDeclarationType apparently chooses to ignore these bits and give a worse diagnostic instead.