https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90920
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- Author: redi Date: Fri Jun 21 17:37:07 2019 New Revision: 272558 URL: https://gcc.gnu.org/viewcvs?rev=272558&root=gcc&view=rev Log: 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. Backport from mainline 2019-06-19 Jonathan Wakely <jwak...@redhat.com> 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. Added: branches/gcc-9-branch/libstdc++-v3/testsuite/25_algorithms/rotate/90920.cc Modified: branches/gcc-9-branch/libstdc++-v3/ChangeLog branches/gcc-9-branch/libstdc++-v3/include/bits/stl_algo.h