This is the mail archive of the
mailing list for the GCC project.
Re: mt_allocator.cc assumes sizeof(size_t) == sizeof(void *)
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: Joel Sherrill <joel dot sherrill at oarcorp dot com>, Joseph Myers <joseph at codesourcery dot com>
- Cc: Jonathan Wakely <jwakely dot gcc at gmail dot com>, GCC Mailing List <gcc at gcc dot gnu dot org>, DJ Delorie <dj at redhat dot com>, libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Mon, 10 Nov 2014 17:58:37 +0100
- Subject: Re: mt_allocator.cc assumes sizeof(size_t) == sizeof(void *)
- Authentication-results: sourceware.org; auth=none
- References: <545CE038 dot 5000403 at oarcorp dot com> <545CE454 dot 1000201 at oracle dot com> <545CF9D3 dot 4090404 at oarcorp dot com> <CAH6eHdSPH73OKc7tuDN+tVWS9vkEqmyFVH-NbOy-ZfOnHPn7=A at mail dot gmail dot com> <CE9C431B-D29F-4B7A-A558-56C60680D369 at oarcorp dot com> <C4E733F6-13E5-4CF4-BCE8-BAE1C556D5B9 at oarcorp dot com> <CAH6eHdSxzdnDFN3zzMtnjHcwo3QavN+ybH163Sz5791NsDKkpQ at mail dot gmail dot com> <545E7F35 dot 6000102 at oracle dot com> <alpine dot DEB dot 2 dot 10 dot 1411101628540 dot 6767 at digraph dot polyomino dot org dot uk> <5460ECB3 dot 5080205 at oarcorp dot com>
On 11/10/2014 05:49 PM, Joel Sherrill wrote:
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)
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.