[PATCH 05/11] A pointer to a pointer is nonnull.

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Mar 21 19:49:00 GMT 2016


On Mar 21 17:37, Peter Rosin wrote:
> On 2016-03-20 12:15, Corinna Vinschen wrote:
> > On Mar 19 13:45, Peter Foley wrote:
> >> GCC 6.0+ can assert that this argument is nonnull.
> >> Remove the unnecessary check to fix a warning.
> >>
> >> winsup/cygwin/ChangeLog
> >> malloc_wrapper.cc (posix_memalign): Remove always true nonnull check.
> > 
> > Eh, what?!?  How on earth can gcc assert memptr is always non-NULL?
> > An application can call posix_memalign(NULL, 4096, 4096) just fine,
> > can't it?  If so, *memptr = res crashes.
> 
> I think that passing NULL qualifies as undefined, in which case the
> crash is ok, no?
> 
> I'm sure it will misbehave if you pass (void **)1 too. So, some might
> argue that the business of special-casing NULL here is questionable.

You have a point there.  I applied v2 of Peter's patch so that
should be ok now.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20160321/dbe69f6a/attachment.sig>


More information about the Cygwin-patches mailing list