From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3b) Gecko/20030119
Description of problem:
Two problems with gcc-3.2-7
1. gcc miscompiles my code (which might be a bordercase
but is accepted with all other compilers i've tested
2. gcc issues a warning in non-optimizing mode but not
when -O is present.
Stupid example is below ...
--- a.c ---
int main(int argc, char *argv)
p = argv;
*p++ = toupper(*p);
--- end a.c ---
$ cc -Wall a.c
a.c: In function `main':
a.c:11: warning: operation on `p' may be undefined
$ ./a.out hallo
$ cc -Wall -O a.c
Version-Release number of selected component (if applicable):
Steps to Reproduce:
Your code triggers undefined behaviour, and as such gcc can do anything it wants
As i wrote above, it might be undefined behavior and
i'm not arguing that (it's just likely to break lots
of existing code).
However (IMHO) gcc should issue the warning consistently
if -Wall is present. I've seen a number of cases where the
warning was not issued, with -O used.
I'm not pushing this but please consider to reopen the bug
for the issue #2 (warning) - i've updated the subject