This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Issue with sub-object __builtin_object_size


On 09/15/2014 11:21 AM, Ulrich Weigand wrote:
Jakub Jelinek wrote:
On Tue, Jun 10, 2014 at 07:37:50PM +0200, Ulrich Weigand wrote:
the following C++ test case:

struct pollfd
   {
     int fd;
     short int events;
     short int revents;
   };

struct Pollfd : public pollfd { };

struct Pollfd myfd[10];

int test (void)
{
   return __builtin_object_size ((struct pollfd *)myfd, 1);
}

ends up returning 8 from the "test" routine, not 80.

This example strikes me as strange. Why do you expect the size of a pointer to the base class subobject to give a meaningful answer, any more than taking the address of a data member?

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]