Commit dadd2dee by Kaveh R. Ghazi Committed by Kaveh Ghazi

strncat.c: Fix uninitialized var.

	* gcc.c-torture/execute/builtins/lib/strncat.c: Fix uninitialized var.
	* gcc.c-torture/execute/builtins/lib/strpbrk.c: Fix discarded const.
	* gcc.c-torture/execute/builtins/strlen-3.c: Fix uninitialized var.
	* gcc.c-torture/execute/builtins/strncmp.c: Delete unused var.

From-SVN: r97386
parent 944c4392
2005-04-01 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2005-04-01 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gcc.c-torture/execute/builtins/lib/strncat.c: Fix uninitialized var.
* gcc.c-torture/execute/builtins/lib/strpbrk.c: Fix discarded const.
* gcc.c-torture/execute/builtins/strlen-3.c: Fix uninitialized var.
* gcc.c-torture/execute/builtins/strncmp.c: Delete unused var.
* gcc.c-torture/execute/builtins/abs-1-lib.c, * gcc.c-torture/execute/builtins/abs-1-lib.c,
gcc.c-torture/execute/builtins/fputs-lib.c, gcc.c-torture/execute/builtins/fputs-lib.c,
gcc.c-torture/execute/builtins/lib/fprintf.c, gcc.c-torture/execute/builtins/lib/fprintf.c,
......
...@@ -7,7 +7,7 @@ char * ...@@ -7,7 +7,7 @@ char *
strncat (char *s1, const char *s2, size_t n) strncat (char *s1, const char *s2, size_t n)
{ {
char *dest = s1; char *dest = s1;
char c; char c = '\0';
#ifdef __OPTIMIZE__ #ifdef __OPTIMIZE__
if (inside_main) if (inside_main)
abort(); abort();
......
extern void abort (void);
extern int inside_main; extern int inside_main;
char * char *
strpbrk(const char *s1, const char *s2) strpbrk(const char *s1, const char *s2)
{ {
char *p; const char *p;
#ifdef __OPTIMIZE__ #ifdef __OPTIMIZE__
if (inside_main) if (inside_main)
abort (); abort ();
...@@ -12,7 +13,7 @@ strpbrk(const char *s1, const char *s2) ...@@ -12,7 +13,7 @@ strpbrk(const char *s1, const char *s2)
{ {
for (p = s2; *p; p++) for (p = s2; *p; p++)
if (*s1 == *p) if (*s1 == *p)
return s1; return (char *)s1;
s1++; s1++;
} }
return 0; return 0;
......
...@@ -18,8 +18,10 @@ int x = 6; ...@@ -18,8 +18,10 @@ int x = 6;
void void
main_test(void) main_test(void)
{ {
#ifdef __OPTIMIZE__
const char *foo; const char *foo;
int i; int i;
#endif
if (strlen (bar) != 13) if (strlen (bar) != 13)
abort (); abort ();
......
...@@ -14,7 +14,6 @@ main_test (void) ...@@ -14,7 +14,6 @@ main_test (void)
{ {
const char *const s1 = "hello world"; const char *const s1 = "hello world";
const char *s2, *s3; const char *s2, *s3;
int n = 6, x;
if (strncmp (s1, "hello world", 12) != 0) if (strncmp (s1, "hello world", 12) != 0)
abort(); abort();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment