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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sayle at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This is triggering the:
          else if (!wi::neg_p (r1val | r1mask, sgn))
            {
              /* Logical right shift, or zero sign bit.  */
              widest_int arg = r1val | r1mask;
              int lzcount = wi::clz (arg);
              lzcount -= wi::get_precision (arg) - width;
              widest_int tmp = wi::mask <widest_int> (width, false);
              tmp = wi::lrshift (tmp, lzcount);
              tmp = wi::lrshift (tmp, wi::bit_and_not (r2val, r2mask));
              *mask = wi::ext (tmp, width, sgn);
              *val = 0;
            }
sgn is UNSIGNED, so wi::neg_p is false even when r1val | r1mask is negative, so
wi::clz (arg) is 0, but wi::get_precision (arg) is 576 and width is 64, so
we end up with lzcount of -512 and I bet the code doesn't expect lzcount to be
negative.

Reply via email to