This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Does TYPE_MAX_VALUE (size_type_node) overflow?
* Richard Guenther:
>> Thanks for the suggestion. ?TYPE_MAX_VALUE (sizetype) appears to be
>> -1, as the result of this code in stor-layout.c:
>>
>> ?/* sizetype is unsigned but we need to fix TYPE_MAX_VALUE so that it is
>> ? ? sign-extended in a way consistent with force_fit_type. ?*/
>> ?max = TYPE_MAX_VALUE (sizetype);
>> ?TYPE_MAX_VALUE (sizetype)
>> ? ?= double_int_to_tree (sizetype, tree_to_double_int (max));
>>
>> Is there a way to obtain the actual maximum value?
>
> It is the actual (sign-extended) maximum value (sizetype values are
> always sign-extended). zero-extending the value gives you the
> "real" maximum value.
I've switched to size_type_node, which seems to be less strange and do
the trick. Took me a while to realize this. Thanks for your support.