public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Paolo Carlini <paolo.carlini@oracle.com>,
	       "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [C++ Patch/RFC] PR 43906
Date: Tue, 05 Aug 2014 01:58:00 -0000	[thread overview]
Message-ID: <53E03A36.5080203@redhat.com> (raw)
In-Reply-To: <53E010B2.6050703@oracle.com>

On 08/04/2014 07:01 PM, Paolo Carlini wrote:
> 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.

I don't see why we wouldn't want to warn in this case; it's still the 
case thet the comparison will always be false.

We can also see this situation for non-function pointers:

void f()
{
   int i;
   if (&i != (int*)0);
}

Jason

  reply	other threads:[~2014-08-05  1:58 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
2014-08-05  1:58     ` Jason Merrill [this message]
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=53E03A36.5080203@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=paolo.carlini@oracle.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).