[PATCH] D41405: Fix an assertion failure regression in isDesignatorAtObjectEnd for __builtin_object_size with incomplete array type in struct

George Burgess IV via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 20 11:31:55 PST 2017


george.burgess.iv added inline comments.


================
Comment at: test/Sema/builtin-object-size.c:105
+void rd36094951_IAS_builtin_object_size_assertion(IncompleteArrayStruct* p) {
+   __builtin___strlcpy_chk (p->session[0].string, "ab", 2, __builtin_object_size(p->session[0].string, 1));
+}
----------------
vsapsai wrote:
> Do we execute significantly different code paths when the second `__builtin_object_size` argument is 0, 2, 3? I think it is worth checking locally if these values aren't causing an assertion. Not sure about having such tests permanently, I'll leave it to you as you are more familiar with the code.
In this case, only 1 and 3 should be touching the buggy codepath, and they should execute it identically. If 0 and 2 reach there, we have bigger problems, since they shouldn't really be poking around in the designator of the given LValue.

Since it's presumably only ~10 seconds of copy-pasting, I'd be happy if we added sanity checks for other modes, as well. :)


Repository:
  rC Clang

https://reviews.llvm.org/D41405





More information about the cfe-commits mailing list