http://llvm.org/bugs/show_bug.cgi?id=15212
Bug ID: 15212
Summary: Clang handles __builtin_object_size in wrong way
Product: clang
Version: 3.2
Hardware: PC
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
__builtin_object_size (void * ptr, int type) returns a constant number of bytes
from ptr to the end of the object ptr pointer points to.
But if type == 1 it understands object as the nearest surrounding of ptr and if
type == 0 it understands object as the whole object, contains the object
ptr points to.
If we write simple example:
#include <stdio.h>
struct a
{
int t[10];
};
int main()
{
a t[10];
printf("%d\n",__builtin_object_size(&t[0].t[0],0));
return 0;
}
Clang will answer 400 and it is right, because it is 4*10*10
But if we changed
printf("%d\n",__builtin_object_size(&t[0].t[0],0));
to
printf("%d\n",__builtin_object_size(&t[0].t[0],1));
Clang will also answer 400 and it is wrong, because the size of t.t is only 40
(10*4).
--
Software Engineer
Intel Compiler Team
Intel Corp.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs