Comments

Richard Biener <richard.guenther@gmail.com> writes:
>>> Looking at the implementation it seems it would also work with>>>>>> return MIN (TREE_INT_CST_EXT_NUNITS (m_t), N / HOST_BITS_PER_WIDE_INT);>>>> Yeah, the MIN in the patch was probably bogus sorry. It only works>> if we can assume that no bitsizetype will have ADDR_MAX_PRECISION>> significant (non-sign) bits -- in particular that there's no such thing as>> an all-1s _unsigned_ bitsizetype. That might be true in practice given>> the way we use offsets, but it isn't safe to generalise that to all N.>>>> A safer form would be:>>>> if (ext_len > OFFSET_INT_ELTS)>> TREE_INT_CST_OFFSET_NUNITS (t) = len;>> else>> TREE_INT_CST_OFFSET_NUNITS (t) = ext_len;>>>> The reason the general form doesn't work for all N is because of the>> compressed representation. E.g. the example I gave a while ago about>> a 256-bit all-1s unsigned number being { -1 } as a 256-bit number and>> { -1, -1, -1, -1, 0 } as a 257+-bit number.>>>> But the point of the patch is to avoid any runtime checks here,>> so the TYPE_PRECISION case is never actually used now. I just kept>> it around for completeness, since we'd been using it successfully so far.>> I can put in a gcc_unreachable if you prefer.>> Yeah, I'd prefer a gcc_unreachable and a comment.
OK, how about this version? Tested on x86_64-linux-gnu.
Thanks,
Richard