On May 22, 2018 6:53:57 PM GMT+02:00, Joseph Myers <jos...@codesourcery.com> wrote: >On Tue, 22 May 2018, Richard Biener wrote: > >> + if (*sptr & (1 << (CHAR_BIT * sizeof (T) - 1))) >> + gcc_unreachable (); >> + m_flag = 1 << ((CHAR_BIT * sizeof (T)) - clz_hwi (*sptr)); > >I don't see how the use of clz_hwi works with a type T that may be >narrower than HOST_WIDE_INT. Surely this logic requires a count of >leading zeros in something of type T, not a possibly larger number of >leading zeros after conversion to HOST_WIDE_INT? Also, if T is wider >than >int, shifting plain 1 won't work here.
I messed up the conversion to a template. The bitnum should be subtracted from HOST_BITS_PER_WIDE_INT and yes, 1 in unsigned hwi should be shifted. Richard.