Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.target / arc / pr9001090948.c
blob103f4aee7ec526d2fda3628f8a8e3b4d637ac9ef
1 /* { dg-do compile } */
2 /* { dg-skip-if "ARC600 doesn't support pic" { arc6xx } } */
3 /* { dg-options "-Os -fPIC" } */
4 #include <stdio.h>
5 #include <string.h>
7 char *
8 strip_trail (const char str[], size_t n)
10 static char buf[1025];
11 int j;
13 strncpy (buf, str, n);
14 buf[n] = '\0';
16 for (j = strlen (buf) - 1; j >= 0; j--)
18 if (buf[j] != ' ')
19 break;
21 buf[j] = '\0';
24 return buf;