From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4784 invoked by alias); 9 Sep 2002 15:39:11 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 4775 invoked from network); 9 Sep 2002 15:39:10 -0000 Received: from unknown (HELO valrhona.uglyboxes.com) (64.1.192.220) by sources.redhat.com with SMTP; 9 Sep 2002 15:39:10 -0000 Received: from localhost.localdomain (IDENT:AcnrbveYjlqR4NXG8Rzxo9yRyhawVpau@localhost.localdomain [127.0.0.1]) by valrhona.uglyboxes.com (8.11.6/8.11.6) with ESMTP id g89Ffq701661; Mon, 9 Sep 2002 08:41:53 -0700 Date: Mon, 09 Sep 2002 08:39:00 -0000 From: Keith Seitz X-X-Sender: keiths@valrhona.uglyboxes.com To: Fred Fish cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] Fix gdb.gdbtk/simple.c strncpy args In-Reply-To: <200209080156.g881u5w10758@beeville.vert.intrinsity.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2002-09/txt/msg00118.txt.bz2 On Sat, 7 Sep 2002, Fred Fish wrote: > Strncpy is supposed to take pointers... > > simple.c: In function `main': > simple.c:15: warning: passing arg 1 of `strncpy' makes pointer from integer without a cast > simple.c:15: warning: passing arg 2 of `strncpy' makes pointer from integer without a cast > WARNING: Testcase compile failed, so some tests in this file will automatically fail. Wow, I thought I'd fixed this a long time ago... Hmmm. Oh, well. I guess not! Of course this is approved! [BTW, insight also follows gdb's standard "obvious fix" rules, too.] Thanks! Keith > 2002-09-07 Fred Fish > > * simple.c: Pass addresses to strncpy, not chars. > > Index: simple.c > =================================================================== > RCS file: /mips/newtools/fsf/gdb/gdb/testsuite/gdb.gdbtk/simple.c,v > retrieving revision 1.1.1.1 > diff -c -p -r1.1.1.1 simple.c > *** simple.c 2002/07/04 20:33:37 1.1.1.1 > --- simple.c 2002/09/08 01:23:50 > *************** main(int argc, char * argv[]) > *** 12,18 **** > { > int j = i % 3; > int k = 3 - j; > ! strncpy (a[i], b[k], j); > foo = (long) j * k / i + 2 * k * k * k; > } > return 0; > --- 12,18 ---- > { > int j = i % 3; > int k = 3 - j; > ! strncpy (&a[i], &b[k], j); > foo = (long) j * k / i + 2 * k * k * k; > } > return 0; >