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); diff --git a/nptl/tst-tsd4.c b/nptl/tst-tsd4.c index cc1ada4d4d..f45cf70e37 100644 --- a/nptl/tst-tsd4.c +++ b/nptl/tst-tsd4.c @@ -34,7 +34,8 @@ destr (void *arg) { ++rounds; - if (pthread_setspecific (key, (void *) 1l) != 0) + /* Use an arbirary but valid pointer to avoid GCC warnings. */ + if (pthread_setspecific (key, (void *) &rounds) != 0) { puts ("destr: setspecific failed"); exit (1); @@ -45,7 +46,7 @@ destr (void *arg) static void * tf (void *arg) { - if (pthread_setspecific (key, (void *) 1l) != 0) + if (pthread_setspecific (key, (void *) &rounds) != 0) { puts ("tf: setspecific failed"); exit (1); diff --git a/sysdeps/pthread/tst-key2.c b/sysdeps/pthread/tst-key2.c index 6828873e41..5662842035 100644 --- a/sysdeps/pthread/tst-key2.c +++ b/sysdeps/pthread/tst-key2.c @@ -56,7 +56,7 @@ tf (void *arg) { pthread_key_t *key = (pthread_key_t *) arg; - if (pthread_setspecific (*key, (void *) -1l) != 0) + if (pthread_setspecific (*key, (void *) arg) != 0) { write_message ("setspecific failed\n"); _exit (1);