On 20/06/19 00:00 +0100, Jonathan Wakely wrote:
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.


Tested x86_64-linux, committed to trunk.

This needs to be backported to gcc-9-branch too.

Committed to gcc-9-branch. I will also add a notice to the
https://gcc.gnu.org/gcc-9/changes.html page.

Reply via email to