From Bugzilla Helper: User-Agent: Mozilla/4.73 [en] (Win95; U) I noticed this when building rpm with a patch that I added in (the one to fix the recursive %if problem in case it matters). I got a bunch of warnings like this... /usr/include/bits/string2.h:237: warning: pointer of type `void *' used in arithmetic Checking the actual line in string2.h... __u = __extension__ ((void *) __u + 1); There's a bunch of those in string2.h It's explicitly cast to a void * then has pointer arithmetic done on it that way? Can someone explain why this is? I'm not the most advanced C programmer, but I'm pretty sure that you're _not_ supposed to do pointer arithmetic on a void *. Reproducible: Always Steps to Reproduce: Compile something with -Wall and #include <string.h>. I specifically saw the problem trying to compile the rpm package and have not tried anything else. Actual Results: Got the warnings mentioned above. Expected Results: No warnings. see above.
I just noticed that rpm is compiling with the -Wpointer-arith flag, I suspect that that is also needed to generate the warning. Additional info: $rpm -q glibc glibc-2.2-12 The version of rpm I am attempting to compile is rpm-4.0.2-7x which has been tweaked to add in the above mentioned patch. When I get time later on I'll try to come up with a simple test case that will reproduce the problem.
Okay, I managed to reproduce this in very simple means (note it also requires optimization to be turned on)... #!/bin/sh cat << EOF > test.c #include <string.h> int main(void) {return 0;} EOF gcc -O -Wpointer-arith -o /dev/null test.c Output of this is as follows... /usr/include/bits/string2.h: In function `__strcpy_small': In file included from /usr/include/string.h:361, from test.c:1: /usr/include/bits/string2.h:418: warning: pointer of type `void *' used in arithmetic /usr/include/bits/string2.h:426: warning: pointer of type `void *' used in arithmetic /usr/include/bits/string2.h:431: warning: pointer of type `void *' used in arithmetic /usr/include/bits/string2.h:436: warning: pointer of type `void *' used in arithmetic /usr/include/bits/string2.h:438: warning: pointer of type `void *' used in arithmetic /usr/include/bits/string2.h:443: warning: pointer of type `void *' used in arithmetic Just to verify that the file string2.h _really_ came from where I think it does... $rpm -qf /usr/include/bits/string2.h glibc-devel-2.2-12 $rpm -V glibc-devel-2.2-12 $
Sorry to keep tacking more onto this, anyways... I found this GNU bug report for libc which describes the problem: http://bugs.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=1501&database=default I reported this one as ver 7.0 because I had updated glibc to version 2.2, but I'm still running gcc from RedHat 6.0 (which is actually egcs). Apparently updating to a version of gcc >= 2.96 _should_ fix the problem (though I'm not gonna bother testing it since I now know that it's not a warning which need be taken seriously). I'll leave this for someone else to close out because it may warrant an errata for 6.x.
The question is which compiler do you use. This is a compiler bug and it is for sure fixed in both gcc-2.96-RH and compat-egcs we shipped in 7.0. 2.95.2 does not have this fixed and from quick look at the 2.95.2 -> 2.95.3 diff 2.95.3 probably does not have it fixed either. gcc supports void * arithmetics as an extension, and this is clearly marked with __extension__.