Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Fix gdb.gdbtk/simple.c strncpy args
@ 2002-09-07 18:56 Fred Fish
  2002-09-09  8:39 ` Keith Seitz
  0 siblings, 1 reply; 2+ messages in thread
From: Fred Fish @ 2002-09-07 18:56 UTC (permalink / raw)
  To: gdb-patches; +Cc: fnf

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.

2002-09-07  Fred Fish  <fnf@intrinsity.com>

	* 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;


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFA] Fix gdb.gdbtk/simple.c strncpy args
  2002-09-07 18:56 [RFA] Fix gdb.gdbtk/simple.c strncpy args Fred Fish
@ 2002-09-09  8:39 ` Keith Seitz
  0 siblings, 0 replies; 2+ messages in thread
From: Keith Seitz @ 2002-09-09  8:39 UTC (permalink / raw)
  To: Fred Fish; +Cc: gdb-patches

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  <fnf@intrinsity.com>
> 
> 	* 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;
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-09-09 15:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-07 18:56 [RFA] Fix gdb.gdbtk/simple.c strncpy args Fred Fish
2002-09-09  8:39 ` Keith Seitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox