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

don hinton via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 28 19:07:17 PDT 2016


hintonda added inline comments.

================
Comment at: lib/Sema/SemaInit.cpp:1926-1927
@@ +1925,4 @@
+      assert(Field != FieldEnd);
+      if (SeenFields[i])
+        continue;
+      if (!Field->isUnnamedBitfield() && !Field->hasInClassInitializer() &&
----------------
rsmith wrote:
> Use `SeenFields[Field->getFieldIndex()]` here and then remove the variable `i`. We don't need to hardcode assumptions about how field indexes are computed here.
You raise a good point I missed.  SeenFields should be big enough to mark all fields, but we should only set/examine from FieldStart->getFieldIndex().  However, we still need the i.


http://reviews.llvm.org/D17407





More information about the cfe-commits mailing list