aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2018-11-12 15:25:40 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2018-11-12 15:25:40 +0000
commitd5cc6de1be9d8fed0b810596efd467d6bee6aa03 (patch)
tree8bf5fbfc56f0d4486bf4389f95bbfa09c95a05f4
parentae78a89f5210015ef21d107ad57d10bcb7ac852c (diff)
downloadgcc-d5cc6de1be9d8fed0b810596efd467d6bee6aa03.zip
gcc-d5cc6de1be9d8fed0b810596efd467d6bee6aa03.tar.gz
gcc-d5cc6de1be9d8fed0b810596efd467d6bee6aa03.tar.bz2
PR libstdc++/87963 fix build for 64-bit mingw
PR libstdc++/87963 * src/c++17/memory_resource.cc (chunk::_M_bytes): Change type from unsigned to uint32_t. (chunk): Fix static assertion for 64-bit targets that aren't LP64. (bigblock::all_ones): Fix undefined shift. From-SVN: r266032
-rw-r--r--libstdc++-v3/ChangeLog8
-rw-r--r--libstdc++-v3/src/c++17/memory_resource.cc15
2 files changed, 14 insertions, 9 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 01a2828..eafdd92 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,11 @@
+2018-11-12 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/87963
+ * src/c++17/memory_resource.cc (chunk::_M_bytes): Change type from
+ unsigned to uint32_t.
+ (chunk): Fix static assertion for 64-bit targets that aren't LP64.
+ (bigblock::all_ones): Fix undefined shift.
+
2018-11-11 Hans-Peter Nilsson <hp@axis.com>
PR libstdc++-v3/54005
diff --git a/libstdc++-v3/src/c++17/memory_resource.cc b/libstdc++-v3/src/c++17/memory_resource.cc
index 781bdad..3595e25 100644
--- a/libstdc++-v3/src/c++17/memory_resource.cc
+++ b/libstdc++-v3/src/c++17/memory_resource.cc
@@ -421,7 +421,7 @@ namespace pmr
// The chunk has space for n blocks, followed by a bitset of size n
// that begins at address words.
// This object does not own p or words, the caller will free it.
- chunk(void* p, size_t bytes, void* words, size_t n)
+ chunk(void* p, uint32_t bytes, void* words, size_t n)
: bitset(words, n),
_M_bytes(bytes),
_M_p(static_cast<std::byte*>(p))
@@ -442,7 +442,7 @@ namespace pmr
}
// Allocated size of chunk:
- unsigned _M_bytes = 0;
+ uint32_t _M_bytes = 0;
// Start of allocated chunk:
std::byte* _M_p = nullptr;
@@ -508,12 +508,9 @@ namespace pmr
{ return std::less<const void*>{}(p, c._M_p); }
};
-#ifdef __LP64__
- // TODO pad up to 4*sizeof(void*) to avoid splitting across cache lines?
- static_assert(sizeof(chunk) == (3 * sizeof(void*)), "");
-#else
- static_assert(sizeof(chunk) == (4 * sizeof(void*)), "");
-#endif
+ // For 64-bit this is 3*sizeof(void*) and for 32-bit it's 4*sizeof(void*).
+ // TODO pad 64-bit to 4*sizeof(void*) to avoid splitting across cache lines?
+ static_assert(sizeof(chunk) == 2 * sizeof(uint32_t) + 2 * sizeof(void*));
// An oversized allocation that doesn't fit in a pool.
struct big_block
@@ -523,7 +520,7 @@ namespace pmr
static constexpr unsigned _S_sizebits
= numeric_limits<size_t>::digits - _S_alignbits;
// The maximum value that can be stored in _S_size
- static constexpr size_t all_ones = (1ul << _S_sizebits) - 1u;
+ static constexpr size_t all_ones = (1ull << _S_sizebits) - 1u;
// The minimum size of a big block
static constexpr size_t min = 1u << _S_alignbits;