This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PR 87059] kludge over MIN_EXPR problem causing VRP failure in value ranges
- From: Jeff Law <law at redhat dot com>
- To: Aldy Hernandez <aldyh at redhat dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Cc: Martin Sebor <msebor at redhat dot com>
- Date: Sat, 25 Aug 2018 13:19:52 -0600
- Subject: Re: [PR 87059] kludge over MIN_EXPR problem causing VRP failure in value ranges
- References: <98ec8da7-9d53-c82a-f483-bc42dc384952@redhat.com>
On 08/24/2018 10:50 AM, Aldy Hernandez wrote:
> As discussed in the PR, the MIN_EXPR being passed to VRP has
> incompatible signs. I expect MIN_EXPR to have the same type for all
> arguments plus the MIN_EXPR node itself, but this is not the case.
>
> The culprit on PPC is expand_builtin_strncmp, but fixing it there causes
> other problems on x86-64 (see PR). I believe Martin Sebor had some
> questions related to the x86 fallout
> (https://gcc.gnu.org/ml/gcc/2018-08/msg00164.html).
>
> Since it seems this has been broken for a while, and I'd like to unbreak
> PPC without having to take my patch out, I suggest (for now) just
> passing the sign of the first argument as VRP had been doing all along
> (through int_const_binop):
>
> int_const_binop():
> ...
> tree type = TREE_TYPE (arg1);
> ...
> if (TREE_CODE (arg1) == INTEGER_CST && TREE_CODE (arg2) == INTEGER_CST)
> {
> wide_int warg1 = wi::to_wide (arg1), res;
> wide_int warg2 = wi::to_wide (arg2, TYPE_PRECISION (type));
> success = wide_int_binop (res, code, warg1, warg2, sign, &overflow);
> poly_res = res;
> }
>
> At some point later, if someone is sufficiently vexed by broken
> MIN_EXPR, we could fix it and the x86 fall out.
>
> OK pending tests?
I don't think we need this after fixing the strncmp code...
Jeff