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

--- Comment #27 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tomasz Kaminski <tkami...@gcc.gnu.org>:

https://gcc.gnu.org/g:2ca5725e104d432317a44ad45183a4f555da3b82

commit r16-293-g2ca5725e104d432317a44ad45183a4f555da3b82
Author: Tomasz KamiÅski <tkami...@redhat.com>
Date:   Fri Apr 25 20:10:52 2025 +0200

    libstdc++: Fix _Padding_sink in case when predicted width is between
padwidth and maxwidth [PR109162]

    The _Padding_sink was behaving incorrectly, when the predicted width (based
on
    code units count) was higher than _M_maxwidth, but lower than _M_padwidth.
    In this case _M_update() returned without calling _M_force_update() and
computing
    field width for Unicode encoding, because _M_buffering() returned 'true'.
    As a consequence we switched to _M_ignoring() mode, while storing a
sequence
    with more code units but smaller field width than _M_maxwidth.

    We now call _M_force_update() if predicted width is greater or equal to
either
    _M_padwidth or _M_maxwidth.

    This happened for existing test case on 32bit architecture.

            PR libstdc++/109162

    libstdc++-v3/ChangeLog:

            * include/std/format (_Padding_sink::_M_update): Fixed condition
for
            calling _M_force_update.
            * testsuite/std/format/debug.cc: Add test that reproduces this
issue
            on 64bit architecture.
            * testsuite/std/format/ranges/sequence.cc: Another edge value test.

Reply via email to