diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-06 15:41:38 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-06 15:41:38 +0000 |
commit | 7050b5fc6f40b601badd486e7624aa641132d91a (patch) | |
tree | 3d4ffb55ede66ac17b980b5df1a89b5c78ca7489 /libstdc++-v3 | |
parent | 89e21edf9b51539df1b7194f81505e01abe8eb2d (diff) | |
download | gcc-7050b5fc6f40b601badd486e7624aa641132d91a.tar.gz |
2009-09-06 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/41267
* include/bits/stl_algobase.h (__copy_move::__copy_m,
__copy_move_backward::__copy_move_b): Don't call __builtin_memmove
with a null third argument.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151459 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 7 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/stl_algobase.h | 10 |
2 files changed, 13 insertions, 4 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 44da8a34504..acc7355ac05 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2009-09-06 Paolo Carlini <paolo.carlini@oracle.com> + + PR libstdc++/41267 + * include/bits/stl_algobase.h (__copy_move::__copy_m, + __copy_move_backward::__copy_move_b): Don't call __builtin_memmove + with a null third argument. + 2009-09-04 Benjamin Kosnik <bkoz@redhat.com> Revert. diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h index 2cef9237d76..c638c547887 100644 --- a/libstdc++-v3/include/bits/stl_algobase.h +++ b/libstdc++-v3/include/bits/stl_algobase.h @@ -375,9 +375,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) static _Tp* __copy_m(const _Tp* __first, const _Tp* __last, _Tp* __result) { - __builtin_memmove(__result, __first, - sizeof(_Tp) * (__last - __first)); - return __result + (__last - __first); + const ptrdiff_t _Num = __last - __first; + if (_Num) + __builtin_memmove(__result, __first, sizeof(_Tp) * _Num); + return __result + _Num; } }; @@ -572,7 +573,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __copy_move_b(const _Tp* __first, const _Tp* __last, _Tp* __result) { const ptrdiff_t _Num = __last - __first; - __builtin_memmove(__result - _Num, __first, sizeof(_Tp) * _Num); + if (_Num) + __builtin_memmove(__result - _Num, __first, sizeof(_Tp) * _Num); return __result - _Num; } }; |