This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: build_int_cstu does not work as advertised
* Richard Guenther:
>> If I don't want sign extension, what function should I use instead?
>> Should I just call build_int_cst_wide directly?
>
> You should use a different type, one that is not sign-extended.
> Non-canonical constants are not allowed as we share them based on
> type and value.
I find it a bit puzzling that GCC deems -1 a canonical constant for an
unsigned type (instead of the passed-in positive value), which leads
to misoptimizations further down the road.
In the meantime, I've realized that I should be using
TYPE_MAX_VALUE (size_type_node), so I think this particular
matter is resolved.