https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90920

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Wed Jun 19 22:57:02 2019
New Revision: 272489

URL: https://gcc.gnu.org/viewcvs?rev=272489&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.

        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:
    trunk/libstdc++-v3/testsuite/25_algorithms/rotate/90920.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/stl_algo.h

Reply via email to