about summary refs log tree commit diff
path: root/nptl/tst-tsd3.c
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2021-04-27 19:05:30 -0600
committerMartin Sebor <msebor@redhat.com>2021-04-27 19:07:49 -0600
commitb25b06749179d8d9a891381466e323a9dd2215f9 (patch)
treed97d85f31a972340e39525545b4670ca184aacca /nptl/tst-tsd3.c
parenta1561c3bbe8e72c6e44280d1eb5e529d2da4ecd0 (diff)
downloadglibc-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 'nptl/tst-tsd3.c')
-rw-r--r--nptl/tst-tsd3.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/nptl/tst-tsd3.c b/nptl/tst-tsd3.c
index 0dd39ccb2b..45c7e4e1ea 100644
--- a/nptl/tst-tsd3.c
+++ b/nptl/tst-tsd3.c
@@ -37,7 +37,8 @@ destr1 (void *arg)
     {
       puts ("set key2");
 
-      if (pthread_setspecific (key2, (void *) 1l) != 0)
+      /* Use an arbirary but valid pointer to avoid GCC warnings.  */
+      if (pthread_setspecific (key2, (void *) &left) != 0)
 	{
 	  puts ("destr1: setspecific failed");
 	  exit (1);
@@ -53,7 +54,8 @@ destr2 (void *arg)
     {
       puts ("set key1");
 
-      if (pthread_setspecific (key1, (void *) 1l) != 0)
+      /* Use an arbirary but valid pointer to avoid GCC warnings.  */
+      if (pthread_setspecific (key1, (void *) &left) != 0)
 	{
 	  puts ("destr2: setspecific failed");
 	  exit (1);
@@ -68,8 +70,9 @@ tf (void *arg)
   /* Let the destructors work.  */
   left = 7;
 
-  if (pthread_setspecific (key1, (void *) 1l) != 0
-      || pthread_setspecific (key2, (void *) 1l) != 0)
+  /* Use an arbirary but valid pointer to avoid GCC warnings.  */
+  if (pthread_setspecific (key1, (void *) &left) != 0
+      || pthread_setspecific (key2, (void *) &left) != 0)
     {
       puts ("tf: setspecific failed");
       exit (1);