https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114040

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> ` -fdisable-tree-evrp -fdisable-tree-vrp1` also fixes it.
> 
> EVRP and VRP1 changes:
>   _3 = IMAGPART_EXPR <_8>;
>   _4 = (_Bool) _3;
>   _5 = (unsigned _BitInt(8671)) _4;
> 
> into
>   _7 = .SUB_OVERFLOW (_2, 0);
>   _3 = IMAGPART_EXPR <_7>;
>   _4 = (unsigned _BitInt(8671)) _3;
> 
> Which looks fine.
> 
> Then bitlower looks to go wrong.

The result of the first multiplication is clearly equal to the third argument
and VRP doesn't know anything extra on it, so it is something from the
sub_overflow_p that goes wrong and computes 1 instead of 0 into the second
multiplication.  But strangely
__attribute__((noipa)) unsigned _BitInt(8671)
foo (unsigned _BitInt(512) x)
{
  return __builtin_sub_overflow_p (x, 0, (unsigned _BitInt(255)) 0);
}

int
main ()
{
  if (foo (0xfffa46471e7c2dd60000000000000000uwb) != 0uwb)
    __builtin_abort ();
}
works fine (and that has what seems to be the same generated code from bitint
lowering for the sub overflow).

Reply via email to