public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Pinski <pinskia@gmail.com>
To: Andrew MacLeod <amacleod@redhat.com>
Cc: Aldy Hernandez <aldyh@redhat.com>, GCC Mailing List <gcc@gcc.gnu.org>
Subject: Re: get_range_query vs NULL argument
Date: Fri, 17 Feb 2023 09:13:03 -0800	[thread overview]
Message-ID: <CA+=Sn1mO92puNK2Y7MJqxnDTW+Lq8jAJFHKXTFg5p19Qk0B0pw@mail.gmail.com> (raw)
In-Reply-To: <009a0ac2-0626-c21c-c0f9-4d2e8daa66b3@redhat.com>

On Wed, Feb 15, 2023 at 2:30 PM Andrew MacLeod <amacleod@redhat.com> wrote:
>
>
> On 2/15/23 14:50, Andrew Pinski wrote:
> > Hi,
> >    While fixing PR 108354, I came across that
> > ssa_name_has_boolean_range calls get_range_query with cfun as the
> > argument but sometimes while in IPA passes cfun is currently nullptr.
> > The question should we check the argument before calling
> > get_range_query or is it a valid thing to call it with a nullptr (and
> > have it return global_ranges in that case)?
>
> That might be ok...  personally I see nothing wrong with:
>
> diff --git a/gcc/value-query.h b/gcc/value-query.h
> index 63878968118..2d7bf8fcf33 100644
> --- a/gcc/value-query.h
> +++ b/gcc/value-query.h
> @@ -140,7 +140,7 @@ get_global_range_query ()
>   ATTRIBUTE_RETURNS_NONNULL inline range_query *
>   get_range_query (const struct function *fun)
>   {
> -  return fun->x_range_query ? fun->x_range_query : &global_ranges;
> +  return (fun && fun->x_range_query) ? fun->x_range_query : &global_ranges;
>   }
>
>   // Query the global range of NAME in function F.  Default to cfun.
>
>
> The client is probably going to do that anyway.

Ok. I will submit a patch which does the above; I had that patch
already when I wrote the email and wanted to double check before
submitting it.

Thanks,
Andrew Pinski

>
> Aldy?
>
>

      parent reply	other threads:[~2023-02-17 17:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15 19:50 Andrew Pinski
2023-02-15 22:30 ` Andrew MacLeod
2023-02-16  7:57   ` Richard Biener
2023-02-16  8:10     ` Aldy Hernandez
2023-02-17 17:13   ` Andrew Pinski [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='CA+=Sn1mO92puNK2Y7MJqxnDTW+Lq8jAJFHKXTFg5p19Qk0B0pw@mail.gmail.com' \
    --to=pinskia@gmail.com \
    --cc=aldyh@redhat.com \
    --cc=amacleod@redhat.com \
    --cc=gcc@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).