PR libstdc++/90920 restore previous checks for empty ranges
authorJonathan Wakely <jwakely@redhat.com>
Wed, 19 Jun 2019 22:57:02 +0000 (23:57 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 19 Jun 2019 22:57:02 +0000 (23:57 +0100)
commit0fd9e8482e73ca8ed74ad390e507f9f922ccc5ce
tree507000ccbcd823d9cdebf76fd49b92b465ad3e42
parentc6f0626b11b25b4159489e4935086ea49d47c541
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.

From-SVN: r272489
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_algo.h
libstdc++-v3/testsuite/25_algorithms/rotate/90920.cc [new file with mode: 0644]