]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR libstdc++/90920 restore previous checks for empty ranges
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 19 Jun 2019 22:57:02 +0000 (22:57 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 19 Jun 2019 22:57:02 +0000 (22:57 +0000)
commit100ba82c20a03d6ff316eb34fb46fe29e5c920fc
tree507000ccbcd823d9cdebf76fd49b92b465ad3e42
parent93094a1969aabd34a4c940e40beb141952aa22c7
PR libstdc++/90920 restore previous checks for empty ranges

The change in r263433 broke the contract of the __rotate functions, by no
longer accepting empty ranges. That means that callers which inlined the
old version of std::rotate (without checks) that end up linking to a new
definition of std::__rotate (also without checks) could perform a divide
by zero and crash.

This restores the old contract of the __rotate overloads.

PR libstdc++/90920 partially revert r263433
* include/bits/stl_algo.h (__rotate): Restore checks for empty ranges.
(rotate): Remove checks.
* testsuite/25_algorithms/rotate/90920.cc: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@272489 138bc75d-0d04-0410-961f-82ee72b054a4
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_algo.h
libstdc++-v3/testsuite/25_algorithms/rotate/90920.cc [new file with mode: 0644]