public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Aldy Hernandez <aldyh@redhat.com>
Cc: GCC patches <gcc-patches@gcc.gnu.org>
Subject: Re: [COMMITTED] frange::maybe_isnan() should return FALSE for undefined ranges.
Date: Wed, 21 Sep 2022 11:36:31 +0200	[thread overview]
Message-ID: <CAFiYyc3mZwi7TW=F9Tu1ge-EJHFULtLq6M5MwNtY8DoTrFtWnA@mail.gmail.com> (raw)
In-Reply-To: <CAGm3qMXzDhdPkipeuUHQDSj7xC41Rd0E3gzp9nS0embghv0fkw@mail.gmail.com>

On Wed, Sep 21, 2022 at 9:52 AM Aldy Hernandez <aldyh@redhat.com> wrote:
>
> The reason the flags were uninitialized was because they were unused,
> similarly for m_type.  But you're right, it is icky and prone to bugs.
> I just thought it was cheap to set_undefined by just flipping
> m_kind=VR_UNDEFINED, but it smells like premature optimization.
>
> How about this?

LGTM

>
> Aldy
>
> On Wed, Sep 21, 2022 at 9:39 AM Richard Biener
> <richard.guenther@gmail.com> wrote:
> >
> > On Tue, Sep 20, 2022 at 8:23 PM Aldy Hernandez via Gcc-patches
> > <gcc-patches@gcc.gnu.org> wrote:
> > >
> > > Undefined ranges have undefined NAN bits.  We can't depend on them,
> > > as they may contain garbage.
> >
> > Ick ;)  Can you add a comment at least?
> >
> > > This patch returns false from
> > > maybe_isnan() for undefined ranges (the empty set).
> > >
> > > gcc/ChangeLog:
> > >
> > >         * value-range.h (frange::maybe_isnan): Return false for
> > >         undefined ranges.
> > > ---
> > >  gcc/value-range.h | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/gcc/value-range.h b/gcc/value-range.h
> > > index 7d5584a9294..325ed08f290 100644
> > > --- a/gcc/value-range.h
> > > +++ b/gcc/value-range.h
> > > @@ -1210,6 +1210,8 @@ frange::known_isinf () const
> > >  inline bool
> > >  frange::maybe_isnan () const
> > >  {
> > > +  if (undefined_p ())
> > > +    return false;
> > >    return m_pos_nan || m_neg_nan;
> > >  }
> > >
> > > --
> > > 2.37.1
> > >
> >

      reply	other threads:[~2022-09-21  9:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20 18:22 Aldy Hernandez
2022-09-21  7:38 ` Richard Biener
2022-09-21  7:52   ` Aldy Hernandez
2022-09-21  9:36     ` Richard Biener [this message]

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='CAFiYyc3mZwi7TW=F9Tu1ge-EJHFULtLq6M5MwNtY8DoTrFtWnA@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=aldyh@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).