From: Jonathan Wakely Date: Wed, 25 Jul 2018 20:23:07 +0000 (+0100) Subject: PR libstdc++/86676 Do not assume stack buffer is aligned X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=17a6321210fe85bc369dae85b4c4b06d952dc041;p=gcc.git 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 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d7a9dbb6ce3..1a0a485bd2c 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,9 @@ 2018-07-25 Jonathan Wakely + 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 header. * acinclude.m4 (glibcxx_SUBDIRS): Add src/c++17. diff --git a/libstdc++-v3/testsuite/20_util/monotonic_buffer_resource/release.cc b/libstdc++-v3/testsuite/20_util/monotonic_buffer_resource/release.cc index 0c7f31789e6..ac70385961d 100644 --- a/libstdc++-v3/testsuite/20_util/monotonic_buffer_resource/release.cc +++ b/libstdc++-v3/testsuite/20_util/monotonic_buffer_resource/release.cc @@ -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 ); }