[rfa/testsuite/threads] fix gcc signed/unsigned warning

Michael Snyder msnyder@redhat.com
Fri Aug 27 02:41:00 GMT 2004


Michael Chastain wrote:
> This patch takes care of one set of gcc HEAD warnings in
> schedlock.c and thread-specific.c.
> 
> The code uses "unsigned int" and "signed int" for the same data, but I'm
> not into changing that right now.  I'm just killing the compiler warning
> so the code can keep doing what it's doing.
> 
> Tested on native i686-pc-linux-gnu with gcc 2.95.3, gcc 3.3.4,
> gcc 3.4.1, and gcc HEAD 20040824, dwarf-2 and stabs+.
> 
> Okay to commit?

Well, it really looks to me as if either args should be
signed, or myp should be unsigned.  The test will work
either way, although signed would "feel" safer.

But if you want to just do this, it's OK with me.

> 
> 2004-08-26  Michael Chastain  <mec.gnu@mindspring.com>
> 
> 	Fix PR testsuite/1735.
> 	* gdb.threads/schedlock.c (thread_function): Add a cast
> 	to suppress a gcc warning.
> 	* gdb.threads/thread-specific.c (thread_function): Likewise.
> 
> Index: gdb.threads/schedlock.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/schedlock.c,v
> retrieving revision 1.4
> diff -c -3 -p -r1.4 schedlock.c
> *** gdb.threads/schedlock.c	26 Aug 2004 13:10:19 -0000	1.4
> --- gdb.threads/schedlock.c	26 Aug 2004 16:40:48 -0000
> ***************
> *** 1,6 ****
>   /* This testcase is part of GDB, the GNU debugger.
>   
> !    Copyright 2002, 2003 Free Software Foundation, Inc.
>   
>      This program is free software; you can redistribute it and/or modify
>      it under the terms of the GNU General Public License as published by
> --- 1,6 ----
>   /* This testcase is part of GDB, the GNU debugger.
>   
> !    Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
>   
>      This program is free software; you can redistribute it and/or modify
>      it under the terms of the GNU General Public License as published by
> *************** int main() {
> *** 52,58 ****
>   
>   void *thread_function(void *arg) {
>       int my_number =  (long) arg;
> !     int *myp = &args[my_number];
>   
>       /* Don't run forever.  Run just short of it :)  */
>       while (*myp > 0)
> --- 52,58 ----
>   
>   void *thread_function(void *arg) {
>       int my_number =  (long) arg;
> !     int *myp = (int *) &args[my_number];
>   
>       /* Don't run forever.  Run just short of it :)  */
>       while (*myp > 0)
> Index: gdb.threads/thread-specific.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/thread-specific.c,v
> retrieving revision 1.1
> diff -c -3 -p -r1.1 thread-specific.c
> *** gdb.threads/thread-specific.c	1 Feb 2004 18:04:37 -0000	1.1
> --- gdb.threads/thread-specific.c	26 Aug 2004 16:40:48 -0000
> *************** int main() {
> *** 53,59 ****
>   
>   void *thread_function(void *arg) {
>       int my_number =  (long) arg;
> !     int *myp = &args[my_number];
>   
>       /* Don't run forever.  Run just short of it :)  */
>       while (*myp > 0)
> --- 53,59 ----
>   
>   void *thread_function(void *arg) {
>       int my_number =  (long) arg;
> !     int *myp = (int *) &args[my_number];
>   
>       /* Don't run forever.  Run just short of it :)  */
>       while (*myp > 0)
> 




More information about the Gdb-patches mailing list