Skip to content
Snippets Groups Projects
Unverified Commit 482e651f authored by Jonathan Wakely's avatar Jonathan Wakely Committed by Jonathan Wakely
Browse files

libstdc++: Fix formatting of most negative chrono::duration [PR116755]

When formatting chrono::duration<signed-integer-type, P>::min() we were
causing undefined behaviour by trying to form the negative of the most
negative value. If we convert negative durations with integer rep to the
corresponding unsigned integer rep then we can safely represent all
values.

libstdc++-v3/ChangeLog:

	PR libstdc++/116755
	* include/bits/chrono_io.h (formatter<duration<R,P>>::format):
	Cast negative integral durations to unsigned rep.
	* testsuite/20_util/duration/io.cc: Test the most negative
	integer durations.
parent b6463161
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment