This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Use an alias to `ptsname_r' in login/tst-ptsname.c
- From: Florian Weimer <fweimer at redhat dot com>
- To: Joseph Myers <joseph at codesourcery dot com>, Arjun Shankar <arjun dot is at lostca dot se>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 24 May 2017 19:42:37 +0200
- Subject: Re: [PATCH] Use an alias to `ptsname_r' in login/tst-ptsname.c
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=fweimer at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 1C2777AE80
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1C2777AE80
- References: <20170524155000.GA45792@aloka.lostca.se> <alpine.DEB.2.20.1705241617190.29027@digraph.polyomino.org.uk>
On 05/24/2017 06:18 PM, Joseph Myers wrote:
> On Wed, 24 May 2017, Arjun Shankar wrote:
>
>> When compiled with `-O3', inlining causes GCC to realize that one of the
>> tests calls `ptsname_r' with a NULL buffer and error out when compiling
>> with -Wnonnull.
>>
>> Declare `ptsname_r_alias' and alias it to `ptsname_r' to avoid this.
>
> Normally in such cases we'd use the DIAG_* macros from libc-diag.h, with
> appropriate comments, to disable the specific warning for the code in
> question.
I think passing NULL to a nonnull parameter is undefined, warning or
not. The GCC documentation is pretty clear about that. (I have some
doubts about the validity of the NULL comparison inside the
implementation of ptsname_r, too.)
Alternatively, we could withdraw the test as invalid, and update the
manual page.
Thanks,
Florian