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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>:

https://gcc.gnu.org/g:988dd22ec6665117e8587389ac85389f1c321c45

commit r13-3548-g988dd22ec6665117e8587389ac85389f1c321c45
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Tue Oct 25 13:03:12 2022 +0100

    libstdc++: Fix allocator propagation in regex algorithms [PR107376]

    The PR points out that we assume the match_results allocator is default
    constuctible, which might not be true. We also have a related issue with
    unwanted propagation from an object that might have an unequal
    allocator.

    Ideally we use the same allocator type for _State_info::_M_match_queue
    but that would be an ABI change now. We should investigate if that can
    be done without breaking anything, which might be possible because the
    _Executor object is short-lived and never leaks out of the regex_match,
    regex_search, and regex_replace algorithms. If we change the mangled
    name for _Executor then there would be no ODR violations when mixing old
    and new definitions. This commit does not attempt that.

    libstdc++-v3/ChangeLog:

            PR libstdc++/107376
            * include/bits/regex_executor.h (_Executor::_Executor): Use same
            allocator for _M_cur_results and _M_results.
            * include/bits/regex_executor.tcc (_Executor::_M_main_dispatch):
            Prevent possibly incorrect allocator propagating to
            _M_cur_results.
            * testsuite/28_regex/algorithms/regex_match/107376.cc: New test.

Reply via email to