This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/36299] spurious and undocumented warning with -Waddress for a == 0 when a is an array
- From: "vincent at vinc17 dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 2 Mar 2011 15:17:47 +0000
- Subject: [Bug c/36299] spurious and undocumented warning with -Waddress for a == 0 when a is an array
- Auto-submitted: auto-generated
- References: <bug-36299-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36299
--- Comment #9 from Vincent LefÃvre <vincent at vinc17 dot org> 2011-03-02 15:17:33 UTC ---
(In reply to comment #8)
> Every warning warns about something valid in C, otherwise it would be an error
> not a warning.
No, for instance:
int main(void)
{
int i;
return i;
}
This is undefined behavior and detected by GCC, but one gets only a warning:
tst.c: In function âmainâ:
tst.c:4: warning: âiâ is used uninitialized in this function
Compare to a == 0 in the above testcase, which has a well-defined behavior.