diff options
author | Martin Sebor <msebor@redhat.com> | 2021-04-27 19:05:30 -0600 |
---|---|---|
committer | Martin Sebor <msebor@redhat.com> | 2021-04-27 19:07:49 -0600 |
commit | b25b06749179d8d9a891381466e323a9dd2215f9 (patch) | |
tree | d97d85f31a972340e39525545b4670ca184aacca /sysdeps/pthread/tst-tsd2.c | |
parent | a1561c3bbe8e72c6e44280d1eb5e529d2da4ecd0 (diff) | |
download | glibc-b25b06749179d8d9a891381466e323a9dd2215f9.tar.gz glibc-b25b06749179d8d9a891381466e323a9dd2215f9.tar.xz glibc-b25b06749179d8d9a891381466e323a9dd2215f9.zip |
Pass a valid pointer to pthread_setspecific to avoid GCC 11 warning.
Diffstat (limited to 'sysdeps/pthread/tst-tsd2.c')
-rw-r--r-- | sysdeps/pthread/tst-tsd2.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sysdeps/pthread/tst-tsd2.c b/sysdeps/pthread/tst-tsd2.c index 275bbccfdd..6b4ca7c49f 100644 --- a/sysdeps/pthread/tst-tsd2.c +++ b/sysdeps/pthread/tst-tsd2.c @@ -27,7 +27,7 @@ static int result; static void destr (void *arg) { - if (arg != (void *) -2l) + if (arg != (void *) &result) result = 2; else result = 0; @@ -40,7 +40,8 @@ tf (void *arg) pthread_key_t key = (pthread_key_t) (long int) arg; int err; - err = pthread_setspecific (key, (void *) -2l); + /* Use an arbirary but valid pointer to avoid GCC warnings. */ + err = pthread_setspecific (key, &result); if (err != 0) result = 3; |