c/976: warings when using strcpy

jeff.deifik@jpl.nasa.gov jeff.deifik@jpl.nasa.gov
Mon Dec 4 10:36:00 GMT 2000


>Number:         976
>Category:       c
>Synopsis:       warings when using strcpy
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 04 10:36:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     jeff deifik
>Release:        gcc version 2.95.2 19991024
>Organization:
>Environment:
red hat 6.2
>Description:
gcc  -O2     -Wpointer-arith  -c a.c
where a.c is:
#include <string.h>

char    a[10], b[10];
void foo(void);
void foo(void) {
    strcpy(a,b);
}

yields:
In file included from /usr/include/string.h:346,
                 from a.c:1:
/usr/include/bits/string2.h: In function `__strcpy_small':
/usr/include/bits/string2.h:419: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:427: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:432: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:437: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:439: warning: pointer of type `void *' used in arithmetic
/usr/include/bits/string2.h:444: warning: pointer of type `void *' used in arithmetic

These warnings are quite annoying, because I use strcpy a lot.

>How-To-Repeat:
compile a.c, in description
>Fix:
unknown
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the Gcc-prs mailing list