mt_allocator.cc assumes sizeof(size_t) == sizeof(void *)

Paolo Carlini paolo.carlini@oracle.com
Mon Nov 10 16:58:00 GMT 2014


Hi,

On 11/10/2014 05:49 PM, Joel Sherrill wrote:
> On 11/10/2014 10:32 AM, Joseph Myers wrote:
>> On Sat, 8 Nov 2014, Paolo Carlini wrote:
>>
>>> Good. Sorry, if I missed some relatively recent development: is now GCC
>>> installing its own stdint.h on *all* the supported targets, thus we can safely
>> No; I sent a list of targets missing the information in
>> <https://gcc.gnu.org/ml/gcc-patches/2013-06/msg00248.html> (possibly out
>> of date now, but the goal there of unifying uint32_type_node and
>> c_uint32_type_node etc. still applies).
>>
> I just submitted a patch using stdint.h and uintptr_t to gcc-patches.
> I think this fixes the code in a standard way. I don't know what to
> do about the list of targets you cited which don't support that.
If you unconditionally use stdint.h facilities you are going to break 
the build on other systems, those missing stdint.h. Note that, assuming 
you want to stick with this sort of general approach, you don't really 
need to use uintptr_t, you can for example fiddle a bit with templates 
and figure out on the fly at compile time an unsigned integer type large 
enough to hold a pointer (for example, what I quickly put together a few 
years ago toward the end of locale_facets.tcc, in do_put, appears to 
work decently well)

Paolo.



More information about the Gcc mailing list