<div dir="ltr">What version of clang/LLVM are you using? George (cc'ed ) has improved __builtin_object_size support in Clang recently.<div><br></div><div>David</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 9, 2016 at 6:37 AM, Strahinja Petrovic via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I have question about __builtin_object_size behaviour. LLVM for __builtin_object_size function doesn't calculate correct value when pointer is used only in __builtin_object_size function call, and never after that. For this case LLVM as result generates 0 or -1 depends of second argument of __builtin_object_size function. Is this correct behaviour or it should work as gcc (gcc calculates correct value for this case) ?<br>
<br>
Example for this issue:<br>
<br>
include <assert.h><br>
int main() {<br>
struct V { char buf1[10];<br>
int b;<br>
char buf2[10];<br>
} var;<br>
<br>
char *p = &var.buf1[1], *q = &var.b;<br>
assert (__builtin_object_size (p, 0) == sizeof (var) - 1);<br>
return 0;<br>
}<br>
<br>
Thanks,<br>
Strahinja<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br></div>