public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH] add attribute none to pthread_setspecific (BZ #27714)
Date: Thu, 22 Apr 2021 16:26:02 -0600	[thread overview]
Message-ID: <107fad46-7374-3bf4-21ae-bcdb4dc0e9a0@gmail.com> (raw)
In-Reply-To: <2ec7fadb-cc15-a005-f708-d2adecc8cc39@gmail.com>

On 4/22/21 3:30 PM, Martin Sebor wrote:
> GCC 11 warns when a pointer to an uninitialized object is passed
> to a function that takes a const-qualified argument.  This is done
> on the assumption that most such functions read from the object.
> For the rare case of a function that doesn't, GCC 11 extended
> attribute access to add a new mode called none.
> 
> POSIX pthread_setspecific() is one such rare function that takes
> a const void* argument but that doesn't read from the object it
> points to.  To suppress the -Wmaybe-uninitialized issued by GCC
> 11 when the address of an uninitialized object is passed to it
> (e.g., the result of malloc()), the attached patch #defines
> __attr_access_none in cdefs.h and uses the macro on the function
> in sysdeps/htl/pthread.h and sysdeps/nptl/pthread.h.
> 
> Martin

The patch is missing the nptl/Makefile change below to add the test:

diff --git a/nptl/Makefile b/nptl/Makefile
index 294bb2faa4..294591bddf 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -316,6 +316,7 @@ tests = tst-attr2 tst-attr3 tst-default-attr \
         tst-pthread-gdb-attach tst-pthread-gdb-attach-static \
         tst-pthread_exit-nothreads \
         tst-pthread_exit-nothreads-static \
+       tst-thread-setspecific

  tests-nolibpthread = \
    tst-pthread_exit-nothreads \

  reply	other threads:[~2021-04-22 22:26 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 [this message]
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
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=107fad46-7374-3bf4-21ae-bcdb4dc0e9a0@gmail.com \
    --to=msebor@gmail.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).