[PATCH] D17407: [Sema] PR25755 Fix crash when initializing out-of-order struct references

don hinton via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 26 15:18:39 PST 2016


hintonda added a comment.

Current diff is incorrect, but I did find the problem.

When iterating over the fields of a record, we use an iterator.  The problem is that if we use a designator, we reset the iterator value, so we can no longer check Field != FieldEnd if the designators are out of order.

So, if we want to allow designators to be out of order, we'll need to keep track of what was actually initialized, not just that we initialized the correct number.  (see SemaInit.cpp:1825)

I'll work up a fix.


http://reviews.llvm.org/D17407





More information about the cfe-commits mailing list