This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix PR78154
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Prathamesh Kulkarni <prathamesh dot kulkarni at linaro dot org>
- Cc: gcc Patches <gcc-patches at gcc dot gnu dot org>, Richard Biener <rguenther at suse dot de>, Martin Sebor <msebor at gmail dot com>
- Date: Wed, 16 Nov 2016 19:55:48 +0100
- Subject: Re: Fix PR78154
- Authentication-results: sourceware.org; auth=none
- References: <CAAgBjMmheAGNCkGjBp-dzi-Rub8yezFCcSB7=8KXh6EwVXg9xA@mail.gmail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Nov 17, 2016 at 12:19:37AM +0530, Prathamesh Kulkarni wrote:
> --- a/gcc/tree-vrp.c
> +++ b/gcc/tree-vrp.c
> @@ -1069,6 +1069,34 @@ gimple_assign_nonzero_warnv_p (gimple *stmt, bool *strict_overflow_p)
> }
> }
>
> +/* Return true if STMT is known to contain call to a string-builtin function
> + that is known to return nonnull. */
> +
> +static bool
> +gimple_str_nonzero_warnv_p (gimple *stmt)
> +{
> + if (!is_gimple_call (stmt))
> + return false;
Shouldn't this be:
if (!gimple_call_builtin_p (stmt, BUILT_IN_NORMAL))
return false;
> +
> + tree fndecl = gimple_call_fndecl (stmt);
> + if (!fndecl || DECL_BUILT_IN_CLASS (fndecl) != BUILT_IN_NORMAL)
> + return false;
And drop the above 2 lines?
That we you also verify the arguments for sanity.
Otherwise I'll defer to Richard.
Jakub