[LLVMbugs] [Bug 15212] New: Clang handles __builtin_object_size in wrong way

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Feb 8 02:54:39 PST 2013


            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: unassignedclangbugs at nondot.org
          Reporter: ili.filippov at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    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];
    return 0;
Clang will answer 400 and it is right, because it is 4*10*10
But if we changed
Clang will also answer 400 and it is wrong, because the size of t.t is only 40

Software Engineer
Intel Compiler Team
Intel Corp.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130208/fb74e0c5/attachment.html>

More information about the llvm-bugs mailing list