This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Issue with sub-object __builtin_object_size
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: jason at redhat dot com (Jason Merrill)
- Cc: jakub at redhat dot com, gcc at gcc dot gnu dot org
- Date: Wed, 17 Sep 2014 15:37:02 +0200 (CEST)
- Subject: Re: Issue with sub-object __builtin_object_size
- Authentication-results: sourceware.org; auth=none
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