From: Paolo Carlini <paolo.carlini@oracle.com>
To: Jason Merrill <jason@redhat.com>,
"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [C++ Patch/RFC] PR 43906
Date: Mon, 04 Aug 2014 23:01:00 -0000 [thread overview]
Message-ID: <53E010B2.6050703@oracle.com> (raw)
In-Reply-To: <53DFF100.6010105@redhat.com>
Hi,
On 08/04/2014 10:45 PM, Jason Merrill wrote:
> On 08/04/2014 12:24 PM, Paolo Carlini wrote:
>> + || (TYPE_PTR_P (type1) && VOID_TYPE_P (TREE_TYPE (type1))
>
> Why check for VOID_TYPE_P? I'd think we would want to warn about
> comparing to other null pointer values as well.
In fact I wondered about that a few minutes after sending my message...
And this is what I figured out: normally we have hard errors from
composite_pointer_type (eg, try scalar types, class types), even for
null values. The only exception I have been able to find earlier today
is that of pointer to the same function type, eg:
extern void z();
typedef void (*ptr)();
void i() { if ( z != (ptr)0 ); }
but in this case the C front-end too doesn't warn. In short, the case of
(void*)0 seems very special.
However, something I did *not* notice earlier today, is that comparing a
pointer to function to a generic void* leads to a pedwarn at the
beginning of composite_pointer_type about the comparison itself. Thus
it's debatable whether we also want the -Waddress warning... If you ask
me, closing the bug with a testcase which checks that we warn for
-pedantic about the comparison (if we don't have one already) would be
Ok (vs EDG 4.9 too) What do you think?
Paolo.
next prev parent reply other threads:[~2014-08-04 23:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-04 16:24 Paolo Carlini
2014-08-04 20:45 ` Jason Merrill
2014-08-04 23:01 ` Paolo Carlini [this message]
2014-08-05 1:58 ` Jason Merrill
2014-08-05 11:49 ` Paolo Carlini
2014-08-05 12:10 ` Paolo Carlini
2014-08-05 12:33 ` Jason Merrill
2014-08-05 14:48 ` Paolo Carlini
2014-08-06 15:19 ` Jason Merrill
2014-08-06 17:07 ` Paolo Carlini
2014-08-06 18:20 ` Jason Merrill
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53E010B2.6050703@oracle.com \
--to=paolo.carlini@oracle.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).