Jason Merrill wrote:
> Well, __builtin_object_size seems to be pretty fragile magic. To make
> it work I guess you could add a wrapper for poll that takes a Pollfd and
> does a reinterpret_cast, i.e.
>
> inline int poll(Pollfd* p, nfds_t n, int t)
> {
>return poll(reinterpret_cast(p), n, t
On 09/16/2014 08:27 AM, Jason Merrill wrote:
On 09/16/2014 06:23 AM, Ulrich Weigand wrote:
Note that with a somewhat equivalent C construct:
struct pollfd
{
int fd;
short int events;
short int revents;
};
struct Pollfd
{
struct pollfd x;
};
struct Pollfd myfd[1
Jason Merrill wrote:
> On 09/16/2014 06:23 AM, Ulrich Weigand wrote:
> > Now in this case, we cast a pointer to the array to a pointer to a base
> > type of the array element type -- but the intent is for the pointer to still
> > refer to the whole array. (Of course, this only works if the base ty
On 09/16/2014 06:23 AM, Ulrich Weigand wrote:
I guess I'm still a bit confused about the special handling of the array
case. Even with the last bit set, array elements normally do not count
as "subobjects", so __builtin_object_size still returns the size of the
full array.
I expect that's beca
Jason Merrill wrote:
> On 09/15/2014 11:55 AM, Ulrich Weigand wrote:
> > (https://gcc.gnu.org/ml/gcc/2014-06/msg00116.html)
>
> > From the __builtin_object_size documentation, it's not immediately
> > clear to me whether this is supposed to work or not:
> >
> >If the least significant
> >b
On 09/15/2014 11:55 AM, Ulrich Weigand wrote:
(https://gcc.gnu.org/ml/gcc/2014-06/msg00116.html)
From the __builtin_object_size documentation, it's not immediately
clear to me whether this is supposed to work or not:
If the least significant
bit is clear, objects are whole variables, if
Jason Merrill wrote:
> 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
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 Pollf
On Mon, Sep 15, 2014 at 05:21:50PM +0200, Ulrich Weigand wrote:
> > The thing is that the C++ FE transforms this kind of cast to
> > &((struct Pollfd *) &myfd)->D.2233
> > so for middle-end where __builtin_object_size is evaluated this
> > is like:
> > struct Pollfd { struct pollfd something; };
>
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 myf
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 __bu
Hello,
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" rou
12 matches
Mail list logo