Commit 213fd717 by Jonathan Wakely Committed by Jonathan Wakely

PR libstdc++/87787 fix UBsan error in std::vector

	PR libstdc++/87787
	* include/bits/stl_uninitialized.h (__relocate_a_1): Do not call
	memmove when there's nothing to copy (and pointers could be null).

From-SVN: r265984
parent fcc49972
2018-11-09 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/87787
* include/bits/stl_uninitialized.h (__relocate_a_1): Do not call
memmove when there's nothing to copy (and pointers could be null).
2018-11-07 Hafiz Abid Qadeer <abidh@codesourcery.com> 2018-11-07 Hafiz Abid Qadeer <abidh@codesourcery.com>
* configure: Regenerated. * configure: Regenerated.
......
...@@ -904,7 +904,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -904,7 +904,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Tp* __result, allocator<_Up>& __alloc) _Tp* __result, allocator<_Up>& __alloc)
{ {
ptrdiff_t __count = __last - __first; ptrdiff_t __count = __last - __first;
__builtin_memmove(__result, __first, __count * sizeof(_Tp)); if (__count > 0)
__builtin_memmove(__result, __first, __count * sizeof(_Tp));
return __result + __count; return __result + __count;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment