Jonathan Wakely e5af77adef libstdc++: Fix how chrono::parse handles errors for time-of-day values
We fail to diagnose an error and extract an incorrect time for cases
like "25:59" >> parse("%H:%M", mins). The bad "25" hour value gets
ignored (on the basis that we might not care about it if trying to
extract something like a weekday or a month name), but then when we get
to the end of the function we think we have a valid time from "59" and
so the result is 00:59.

The problem is that the '__bad_h' value is used for "no hour value read
yet" as well as "bad hour value read". If we just set __h = __bad_h and
continue, we can't tell later that we read an invalid hour.

The fix is to set failbit early when we're trying to extract a
time-of-day (e.g. duration or time_point) and we encounter an invalid
hour, minute, or second value. We can still delay other error checking
to the end.

libstdc++-v3/ChangeLog:

	* include/bits/chrono_io.h (_Parser::operator()): Set failbit
	early if invalid values are read when _M_need & _TimeOfDay is
	non-zero.
	* testsuite/std/time/parse.cc: Check that "25:59" cannot be
	parsed for "%H:%M".
2023-09-01 09:55:48 +01:00
2023-08-12 00:17:36 +00:00
2023-08-30 00:18:25 +00:00
2023-08-18 00:16:52 +00:00
2023-08-23 00:17:59 +00:00
2023-08-12 00:17:36 +00:00
2023-08-24 00:18:18 +00:00
2023-08-12 00:17:36 +00:00
2023-08-13 00:16:46 +00:00
2023-08-26 00:18:03 +00:00
2023-08-23 00:17:59 +00:00
2023-08-21 00:17:21 +00:00
2023-08-30 00:18:25 +00:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
Description
No description provided
Readme 4.2 GiB
Languages
C++ 30.8%
C 30.2%
Ada 14.4%
D 6.1%
Go 5.7%
Other 12.3%