This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PR 87059] kludge over MIN_EXPR problem causing VRP failure in value ranges

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
> (
> 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...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]