[PATCH] D12000: Bugfix - Clang handles __builtin_object_size in wrong way

George Burgess IV via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 17 13:08:22 PDT 2015


george.burgess.iv added inline comments.

================
Comment at: lib/AST/ExprConstant.cpp:6221-6223
@@ +6220,5 @@
+  //
+  //   extern struct X { char buff[32]; int a, b, c; } *p;
+  //   int a = __builtin_object_size(p->buff + 4, 3); // returns 28
+  //   int b = __builtin_object_size(p->buff + 4, 2); // returns 0, not 40
+  //
----------------
rsmith wrote:
> Please add a testcase like this (where the base object is unknown but the designator is known, and thus we can compute the Type == 1 and Type == 3 forms but not the Type == 0 and Type == 2 forms).
EvaluatePointer is stricter than I thought -- this is actually not possible without adding a decent amount of complexity to the current patch. Will replace the comment with a TODO, and add the test case in the next patch that makes us support things like this. :)


http://reviews.llvm.org/D12000





More information about the cfe-commits mailing list