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


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<pollfd*>(p), n, t);
> }
> 
> so that you force the conversion to ignore the inheritance relationship 
> and thereby avoid the COMPONENT_REF.

That does indeed seem to work for my test case, thanks!

Given that the _FORTIFY_SOURCE documentation already states that:

  With _FORTIFY_SOURCE set to 2 some more checking is added,
  but some conforming  programs  might fail. 

I guess having to use a workaround like the above is good enough.

Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com


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