31 Dec
2003
31 Dec
'03
14:22
Marcus Meissner <meissner@suse.de> writes:
But why is there no warning when optimization is turned on? (When the warning is actually needed :-) This is my main point.
It is there with -Wall on SuSE Linux 9.0:
$ cat xx.c void f(char *s) { while (*s) { *s++ = *s | 0x20; } } $ gcc -O2 -Wall -c xx.c xx.c: In function `f': xx.c:3: Warnung: operation on `s' may be undefined
It is the toupper that turns it off then: markgray@soyo:/usr/src/packages/BUILD/bug> cat xx.c #include <ctype.h> void strupr_OLD (char *s) { while (*s) { *s++ = toupper(*s); } } markgray@soyo:/usr/src/packages/BUILD/bug> gcc -O2 -Wall -c xx.c markgray@soyo:/usr/src/packages/BUILD/bug> (This is also 9.0 btw)