https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124851
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Tomasz Kaminski <[email protected]>: https://gcc.gnu.org/g:864f26bd7548d1a290b334b8f5375199449fcff5 commit r17-484-g864f26bd7548d1a290b334b8f5375199449fcff5 Author: Álvaro Begué <[email protected]> Date: Sun Apr 26 19:51:17 2026 -0400 libstdc++: Fix numeric save offset on Zone lines [PR124851] When a Zone line specifies a numeric value as its RULES field (the constant DST save value for that zone line, e.g. Africa/Gaborone's "2 1 CAST" line), the parser stored the standard offset alone in ZoneInfo::m_offset. ZoneInfo::to() then returned that as sys_info::offset, dropping the numeric save and reporting a total offset that was wrong by the save amount. This was inconsistent with the two ZoneInfo constructors that take a sys_info, which previously stored the *total* offset (stdoff + save) in m_offset. As a result m_offset's semantics depended on which code path created the ZoneInfo, and only the parser path's lines with non-zero numeric save were observably broken. Fix by giving m_offset a single semantics: always the standard offset only. The two sys_info-taking constructors now subtract the save before storing, and to(0 adds it back when reconstructing the sys_info. The remaining .offset() callers inside _M_get_sys_info already expect the standard offset (they are computing rule firing times, where the save component is added separately from the active rule's save value), so no other call sites need adjustment. libstdc++-v3/ChangeLog: PR libstdc++/124851 * src/c++20/tzdb.cc (ZoneInfo::ZoneInfo(sys_info&&)): Store stdoff only in m_offset (subtract info.save). (ZoneInfo::ZoneInfo(const pair<sys_info, string_view>&)): Likewise. (ZoneInfo::offset()): Document new semantics. (ZoneInfo::to(sys_info&)): Add m_save back to offset() when populating sys_info::offset. * testsuite/std/time/time_zone/numeric_save.cc: New test. Reviewed-by: Jonathan Wakely <[email protected]> Reviewed-by: Tomasz KamiÅski <[email protected]> Signed-off-by: Álvaro Begué <[email protected]>
