PR libstdc++/86676 Do not assume stack buffer is aligned
PR libstdc++/86676 * testsuite/20_util/monotonic_buffer_resource/release.cc: Allow for buffer being misaligned and so returned pointer not being at start. From-SVN: r262980
This commit is contained in:
parent
0fc1c4290b
commit
17a6321210
|
@ -1,5 +1,9 @@
|
|||
2018-07-25 Jonathan Wakely <jwakely@redhat.com>
|
||||
|
||||
PR libstdc++/86676
|
||||
* testsuite/20_util/monotonic_buffer_resource/release.cc: Allow for
|
||||
buffer being misaligned and so returned pointer not being at start.
|
||||
|
||||
* include/experimental/memory_resource: Include <cstddef> header.
|
||||
|
||||
* acinclude.m4 (glibcxx_SUBDIRS): Add src/c++17.
|
||||
|
|
|
@ -115,10 +115,12 @@ test04()
|
|||
unsigned char buffer[1024];
|
||||
std::pmr::monotonic_buffer_resource mbr(buffer, sizeof(buffer), &r);
|
||||
void* p = mbr.allocate(800, 16);
|
||||
VERIFY( p == buffer );
|
||||
VERIFY( p >= buffer && p < (buffer + 16) );
|
||||
void* const p_in_buffer = p;
|
||||
VERIFY( r.allocate_calls == 0 );
|
||||
p = mbr.allocate(300, 1);
|
||||
VERIFY( p != buffer );
|
||||
VERIFY( p != buffer );
|
||||
VERIFY( r.allocate_calls == 1 );
|
||||
mbr.release();
|
||||
VERIFY( r.deallocate_calls == 1 );
|
||||
|
@ -126,7 +128,7 @@ test04()
|
|||
VERIFY( r.number_of_active_allocations() == 0 );
|
||||
// initial buffer should be used again now:
|
||||
p = mbr.allocate(1000);
|
||||
VERIFY( p == buffer );
|
||||
VERIFY( p == p_in_buffer );
|
||||
VERIFY( r.allocate_calls == 1 );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue