public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: Joseph Myers <joseph@codesourcery.com>
Cc: Florian Weimer <fweimer@redhat.com>,
	Martin Sebor via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: [PATCH] add attribute none to pthread_setspecific (BZ #27714)
Date: Tue, 27 Apr 2021 15:46:46 -0600	[thread overview]
Message-ID: <571eb466-8979-8579-3b52-38f29a628a39@gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2104272104100.39318@digraph.polyomino.org.uk>

On 4/27/21 3:07 PM, Joseph Myers wrote:
> On Tue, 27 Apr 2021, Martin Sebor via Libc-alpha wrote:
> 
>> You're right.  I had inadvertently reverted the pthread.h changes so
>> my testing didn't expose it.  Too many patches in the same tree...
>> I've committed a1561c3bbe with the missing definition (and retesting
>> the macro).
> 
> How was that commit tested?  It breaks the glibc testsuite build for me
> with GCC 11 (on x86_64, also seen on lots of other architectures with
> build-many-glibcs.py).

These are warnings in my build (I've seen a few others scroll by
and have always assumed they were expected(*)).  Those you pasted
below are intended: the none mode implies that const void* pointer
should point to an object 1 byte in size (that excludes valid,
past-the-end pointers, something I've been meaning to add
an extension for).  The test should change to use a valid pointer.
I test by simply running make check.  I can make the change to
the test if you expect warning-free test builds.

Martin

[*] Here's an example of a warning I just noticed while rerunning
make check:

tst-chk1.c: In function ‘do_test’:
../bits/select.h:37:51: warning: value computed is not used [-Wunused-value]
    37 |   ((__FDS_BITS (s)[__FD_ELT (d)] & __FD_MASK (d)) != 0)
       |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
../misc/sys/select.h:87:33: note: in expansion of macro ‘__FD_ISSET’
    87 | #define FD_ISSET(fd, fdsetp)    __FD_ISSET (fd, fdsetp)
       |                                 ^~~~~~~~~~
tst-chk1.c:1681:3: note: in expansion of macro ‘FD_ISSET’
  1681 |   FD_ISSET (FD_SETSIZE - 1, &s);
       |   ^~~~~~~~

> 
> tst-tsd3.c: In function 'tf':
> tst-tsd3.c:71:7: error: 'pthread_setspecific' expecting 1 byte in a region of size 0 [-Werror=stringop-overread]
>     71 |   if (pthread_setspecific (key1, (void *) 1l) != 0
>        |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from ../include/pthread.h:1,
>                   from tst-tsd3.c:20:
> ../sysdeps/nptl/pthread.h:1184:12: note: in a call to function 'pthread_setspecific' declared with attribute 'access (none, 2)'
>   1184 | extern int pthread_setspecific (pthread_key_t __key,
>        |            ^~~~~~~~~~~~~~~~~~~
> tst-tsd3.c:72:10: error: 'pthread_setspecific' expecting 1 byte in a region of size 0 [-Werror=stringop-overread]
>     72 |       || pthread_setspecific (key2, (void *) 1l) != 0)
>        |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from ../include/pthread.h:1,
>                   from tst-tsd3.c:20:
> ../sysdeps/nptl/pthread.h:1184:12: note: in a call to function 'pthread_setspecific' declared with attribute 'access (none, 2)'
>   1184 | extern int pthread_setspecific (pthread_key_t __key,
>        |            ^~~~~~~~~~~~~~~~~~~
> tst-tsd3.c: In function 'destr2':
> tst-tsd3.c:56:11: error: 'pthread_setspecific' expecting 1 byte in a region of size 0 [-Werror=stringop-overread]
>     56 |       if (pthread_setspecific (key1, (void *) 1l) != 0)
>        |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from ../include/pthread.h:1,
>                   from tst-tsd3.c:20:
> ../sysdeps/nptl/pthread.h:1184:12: note: in a call to function 'pthread_setspecific' declared with attribute 'access (none, 2)'
>   1184 | extern int pthread_setspecific (pthread_key_t __key,
>        |            ^~~~~~~~~~~~~~~~~~~
> tst-tsd3.c: In function 'destr1':
> tst-tsd3.c:40:11: error: 'pthread_setspecific' expecting 1 byte in a region of size 0 [-Werror=stringop-overread]
>     40 |       if (pthread_setspecific (key2, (void *) 1l) != 0)
>        |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from ../include/pthread.h:1,
>                   from tst-tsd3.c:20:
> ../sysdeps/nptl/pthread.h:1184:12: note: in a call to function 'pthread_setspecific' declared with attribute 'access (none, 2)'
>   1184 | extern int pthread_setspecific (pthread_key_t __key,
>        |            ^~~~~~~~~~~~~~~~~~~
> 
> (I also see similar errors building tst-tsd4.c.  The testsuite builds
> cleanly with the same compiler and the previous glibc commit.)
> 


  reply	other threads:[~2021-04-27 21:46 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22 21:30 Martin Sebor
2021-04-22 22:26 ` Martin Sebor
2021-04-23  0:11 ` Paul Eggert
2021-04-23 15:24   ` Martin Sebor
2021-04-23 20:19     ` Paul Eggert
2021-04-23 21:29       ` Martin Sebor
2021-04-24  0:27         ` Paul Eggert
2021-04-26 19:38           ` Martin Sebor
2021-04-27  4:41 ` Florian Weimer
2021-04-27 19:07   ` Martin Sebor
2021-04-27 21:07     ` Joseph Myers
2021-04-27 21:46       ` Martin Sebor [this message]
2021-04-27 21:58         ` Joseph Myers
2021-04-27 22:57           ` Martin Sebor
2021-04-28  1:09             ` Martin Sebor
2021-04-28  7:32               ` Florian Weimer
2021-04-28 14:49                 ` Martin Sebor
2021-04-29  7:45                   ` Florian Weimer
2021-04-29 14:55                     ` Martin Sebor
2021-04-29 16:16                       ` Florian Weimer
2021-04-28  1:30             ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=571eb466-8979-8579-3b52-38f29a628a39@gmail.com \
    --to=msebor@gmail.com \
    --cc=fweimer@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).