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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-08-17
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
      shift = exact_log2 (INTVAL (XEXP (XEXP (x, 0), 1)));
      if (INTVAL (XEXP (x, 1)) != (HOST_WIDE_INT)0xffffffff << shift)
        shift = -1;

Simple fix is check shift to be -1 before doing the other check.
That is:
      if (shift == -1
          || INTVAL (XEXP (x, 1)) != (HOST_WIDE_INT)0xffffffff << shift)
        shift = -1;
Or:
      if (shift != -1
          && INTVAL (XEXP (x, 1)) != (HOST_WIDE_INT)0xffffffff << shift)
        shift = -1;

Both are valid as shift will be -1 before or afterwards :).

Reply via email to