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 01:15:26 +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 #7 from Vincent LefÃvre <vincent at vinc17 dot org> 2011-03-02 01:15:23 UTC ---
(In reply to comment #6)
> I think the intention is to warn, at least for a == (void *)0, since the
> address of a cannot be zero or null. So I would say that this is a regression.
But this is valid in C, and in practice, such a test can occur in macro
expansions: a macro can check whether some pointer is null before doing
something with it. There shouldn't be a warning in such a case.