mirror of
https://gcc.gnu.org/git/gcc.git
synced 2025-01-18 02:14:31 +08:00
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
This commit is contained in:
parent
ae78a89f52
commit
d5cc6de1be
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user