public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Andrew MacLeod <amacleod@redhat.com>
Cc: Andrew Pinski <pinskia@gmail.com>,
	Aldy Hernandez <aldyh@redhat.com>,
	 GCC Mailing List <gcc@gcc.gnu.org>
Subject: Re: get_range_query vs NULL argument
Date: Thu, 16 Feb 2023 08:57:45 +0100	[thread overview]
Message-ID: <CAFiYyc0GZY+nOFFhed5PyrCEyn+85m+QGgnNj03QYmYDb6PzyQ@mail.gmail.com> (raw)
In-Reply-To: <009a0ac2-0626-c21c-c0f9-4d2e8daa66b3@redhat.com>

On Wed, Feb 15, 2023 at 11:31 PM Andrew MacLeod via Gcc <gcc@gcc.gnu.org> 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.

But if there's no 'fun', what is 'global_ranges' initialized for?  Or
is 'global_ranges'
usable in IPA context?

> Aldy?
>
>

  reply	other threads:[~2023-02-16  7:57 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 [this message]
2023-02-16  8:10     ` Aldy Hernandez
2023-02-17 17:13   ` Andrew Pinski

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=CAFiYyc0GZY+nOFFhed5PyrCEyn+85m+QGgnNj03QYmYDb6PzyQ@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=aldyh@redhat.com \
    --cc=amacleod@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=pinskia@gmail.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).