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

            Bug ID: 109857
           Summary: tzdata 2021a has bad data that cannot be parsed by
                    libstdc++
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

On debian stable the tzdata.zi file is from version 2021a of the IANA time zone
database and contains this line:

R K 2023 Max - O lastTh 24 0 -

This is invalid, because the fourth field should be "max" not "Max". This
causes libstdc++ to fail to parse the tzdata file and use a UTC-only fallback.

Maybe we should do:

--- a/libstdc++-v3/src/c++20/tzdb.cc
+++ b/libstdc++-v3/src/c++20/tzdb.cc
@@ -345,8 +345,9 @@ namespace std::chrono

       friend istream& operator>>(istream& in, minmax_year&& y)
       {
-       if (ws(in).peek() == 'm') // keywords "minimum" or "maximum"
+       if (unsigned char c = ws(in).peek(); std::tolower(c) == 'm')
          {
+           // keywords "minimum" or "maximum"
            string s;
            in >> s; // extract the rest of the word, but only look at s[1]
            if (s[1] == 'a')


We should also consider ignoring the system tzdata files if the bundled copy
(currently 2023c) is newer. Or at least try using the bundled one if the
parsing the system file fails, as in this case.

Reply via email to