aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2014-11-14 16:57:20 +0000
committerJoel Sherrill <joel@gcc.gnu.org>2014-11-14 16:57:20 +0000
commit2c59c2d1a2c4903513e6978655eac9159912762d (patch)
tree219a0c4f39efc4c6a5815d5dd50b1b4bab3a9dd3 /libstdc++-v3
parentba86734cb3165b4dd2c0885a7a27ba89d3a9b563 (diff)
downloadgcc-2c59c2d1a2c4903513e6978655eac9159912762d.zip
gcc-2c59c2d1a2c4903513e6978655eac9159912762d.tar.gz
gcc-2c59c2d1a2c4903513e6978655eac9159912762d.tar.bz2
mt_allocator.cc: Fix assumption that sizeof(void *) is equal to sizeof(size_t).
2014-11-14 Joel Sherrill <joel.sherrill@oarcorp.com> * src/c++98/mt_allocator.cc: Fix assumption that sizeof(void *) is equal to sizeof(size_t). The m32c breaks this assumption. From-SVN: r217576
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/src/c++98/mt_allocator.cc9
2 files changed, 12 insertions, 2 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 18e214f..c6f32e4 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-14 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * src/c++98/mt_allocator.cc: Fix assumption that sizeof(void *) is
+ equal to sizeof(size_t). The m32c breaks this assumption.
+
2014-11-14 Jonathan Wakely <jwakely@redhat.com>
* config/abi/pre/gnu.ver: Add new exports.
diff --git a/libstdc++-v3/src/c++98/mt_allocator.cc b/libstdc++-v3/src/c++98/mt_allocator.cc
index 38e17df..51b2605 100644
--- a/libstdc++-v3/src/c++98/mt_allocator.cc
+++ b/libstdc++-v3/src/c++98/mt_allocator.cc
@@ -31,6 +31,11 @@
#include <ext/mt_allocator.h>
#include <cstring>
+// The include file is needed for uintptr_t. If this file does not compile,
+// check to make sure the target has <stdint.h> and that it provides
+// uintptr_t.
+#include <stdint.h>
+
namespace
{
#ifdef __GTHREADS
@@ -74,7 +79,7 @@ namespace
__freelist& freelist = get_freelist();
{
__gnu_cxx::__scoped_lock sentry(get_freelist_mutex());
- size_t _M_id = reinterpret_cast<size_t>(__id);
+ uintptr_t _M_id = reinterpret_cast<uintptr_t>(__id);
typedef __gnu_cxx::__pool<true>::_Thread_record _Thread_record;
_Thread_record* __tr = &freelist._M_thread_freelist_array[_M_id - 1];
@@ -627,7 +632,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
__freelist& freelist = get_freelist();
void* v = __gthread_getspecific(freelist._M_key);
- size_t _M_id = (size_t)v;
+ uintptr_t _M_id = (uintptr_t)v;
if (_M_id == 0)
{
{