[PATCH] D12821: Allow for C's "writing off the end" idiom in __builtin_object_size

George Burgess IV via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 9 11:24:14 PDT 2015


george.burgess.iv added inline comments.

================
Comment at: lib/AST/ExprConstant.cpp:6331-6333
@@ +6330,5 @@
+      BaseType = CAT->getElementType();
+    } else if (BaseType->isAnyComplexType()) {
+      auto *CT = BaseType->castAs<ComplexType>();
+      BaseType = CT->getElementType();
+    } else if (auto *FD = getAsField(LVal.Designator.Entries[I])) {
----------------
rsmith wrote:
> You should check that the `ArrayIndex` is 1 in this case (a pointer to the `__real__` component doesn't point to the end of the object).
Nice catch!


http://reviews.llvm.org/D12821





More information about the cfe-commits mailing list