From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14890 invoked by alias); 23 Aug 2008 12:55:12 -0000 Received: (qmail 14367 invoked by uid 48); 23 Aug 2008 12:53:52 -0000 Date: Sat, 23 Aug 2008 12:55:00 -0000 Message-ID: <20080823125352.14366.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c/36299] spurious and undocumented warning with -Waddress for a == 0 when a is an array In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "manu at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-08/txt/msg01756.txt.bz2 ------- Comment #2 from manu at gcc dot gnu dot org 2008-08-23 12:53 ------- Andrew, how could we detect that it is a decayed array? I think we would like to warn for if (a == (void *) 0) but not for if ((void *)a == 0) or even if possible not for if (&a[0] == 0) Vincent, this warning was added on purpose, because probably someone requested it. I don't see that it is very different from the documented case of using the address of a function in a conditional. You should be able to work-around the macro case by casting the array to (char *) or perhaps casting to (void *) ? That said, we would like to not warn within macros for a wide range of warnings but we don't have the infrastructure to do that yet. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36299