[prev in list] [next in list] [prev in thread] [next in thread]
List: cfe-commits
Subject: Re: [PATCH] D12000: Bugfix - Clang handles __builtin_object_size in wrong way
From: Richard Smith via cfe-commits <cfe-commits () lists ! llvm ! org>
Date: 2015-08-15 0:11:43
Message-ID: d5528ac10f3ba14430f0213b3dc903eb () localhost ! localdomain
[Download RAW message or body]
rsmith added a subscriber: rsmith.
================
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
+ //
----------------
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).
================
Comment at: lib/AST/ExprConstant.cpp:6243-6245
@@ +6242,5 @@
+ } else if (End.Designator.IsOnePastTheEnd) {
+ // We're already pointing at the end of the object.
+ AmountToAdd = 0;
+ }
+
----------------
Please add testcases for the pointer-to-the-end case:
int n;
static_assert(__builtin_object_size(&n + 1, 1) == 0);
struct X { int a, b, c; } x;
static_assert(__builtin_object_size(&x.a + 1, 1) == 0);
http://reviews.llvm.org/D12000
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic