c/1750: suprrious warning when using memset

jdeifik@jpl.nasa.gov jdeifik@jpl.nasa.gov
Tue Jan 23 14:26:00 GMT 2001


>Number:         1750
>Category:       c
>Synopsis:       suprrious warning when using memset
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 23 14:26:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     jeff deifik
>Release:        gcc version 2.95.2 19991024
>Organization:
>Environment:
redhat linux 6.2
>Description:
/* repeat by:
   gcc -c -g -O  -Wpointer-arith  gcc-bug-memset.c */
/* gcc -v says:
Reading specs from /home/jdeifik/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/specs
gcc version 2.95.2 19991024 (release) */


#include <string.h>

void foo(void) 
{
    char a[10], b[10];
    
    memset(a, 3, 1);
}


generates:
In file included from /usr/include/string.h:346,
                 from gcc-bug-memset.c:8:
/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
gcc-bug-memset.c: In function `foo':
gcc-bug-memset.c:14: warning: pointer of type `void *' used in arithmetic
gcc-bug-memset.c:14: warning: pointer of type `void *' used in arithmetic
gcc-bug-memset.c:14: warning: pointer of type `void *' used in arithmetic
gcc-bug-memset.c:14: warning: pointer of type `void *' used in arithmetic
gcc-bug-memset.c:14: warning: pointer of type `void *' used in arithmetic
gcc-bug-memset.c:14: warning: pointer of type `void *' used in arithmetic
gcc-bug-memset.c:14: warning: pointer of type `void *' used in arithmetic
gcc-bug-memset.c:14: warning: pointer of type `void *' used in arithmetic
gcc-bug-memset.c:14: warning: pointer of type `void *' used in arithmetic
gcc-bug-memset.c:14: warning: pointer of type `void *' used in arithmetic
gcc-bug-memset.c:14: warning: pointer of type `void *' used in arithmetic
gcc-bug-memset.c:14: warning: pointer of type `void *' used in arithmetic
gcc-bug-memset.c:14: warning: pointer of type `void *' used in arithmetic
>How-To-Repeat:
gcc -c -g -O  -Wpointer-arith  gcc-bug-memset.c
>Fix:
unknown
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the Gcc-bugs mailing list