This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] c++98/mt_allcoator.cc: Fix assumption sizeof(void *) == sizeof(size_t)
- From: Joel Sherrill <joel dot sherrill at oarcorp dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Joel Sherrill <joel dot sherrill at oarcorp dot com>
- Date: Mon, 10 Nov 2014 09:36:07 -0600
- Subject: [PATCH] c++98/mt_allcoator.cc: Fix assumption sizeof(void *) == sizeof(size_t)
- Authentication-results: sourceware.org; auth=none
2014-11-10 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.
---
libstdc++-v3/src/c++98/mt_allocator.cc | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libstdc++-v3/src/c++98/mt_allocator.cc b/libstdc++-v3/src/c++98/mt_allocator.cc
index 38e17df..04dd8ad 100644
--- a/libstdc++-v3/src/c++98/mt_allocator.cc
+++ b/libstdc++-v3/src/c++98/mt_allocator.cc
@@ -30,6 +30,7 @@
#include <ext/concurrence.h>
#include <ext/mt_allocator.h>
#include <cstring>
+#include <stdint.h>
namespace
{
@@ -74,7 +75,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 +628,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)
{
{
--
1.9.3