]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix type in computation of _M_weekday_index.
authorTomasz Kamiński <tkaminsk@redhat.com>
Wed, 8 Oct 2025 13:14:04 +0000 (15:14 +0200)
committerTomasz Kamiński <tkaminsk@redhat.com>
Wed, 8 Oct 2025 13:14:04 +0000 (15:14 +0200)
The value should use divide instead of modulo, as given 1st of month
being weekday X (Mon, Tue, ...), 01 is always X[1], 08 is X[2], e.t.c.

This values is currently not observable, as there is no user-accessible
format specifier that will print it, however it may be exposed in future.

libstdc++-v3/ChangeLog:

* include/bits/chrono_io.h (_ChronoData::_M_fill_day): Replace
'%' by '/'.

libstdc++-v3/include/bits/chrono_io.h

index 79a44d128b12577785a3e8819a292807f7f20aff..690c10d79ce5c441f01baf379e54a13364a2ebac 100644 (file)
@@ -463,7 +463,7 @@ namespace __format
       {
        _M_day = __d;
        __parts -= _ChronoParts::_Day;
-       _M_weekday_index = ((unsigned)__d + 6u) % 7u;
+       _M_weekday_index = ((unsigned)__d + 6u) / 7u;
        __parts -= _ChronoParts::_WeekdayIndex;
        return __parts;
       }