[gcc r14-11451] libstdc++: Cast -1 to size_t in <format> [PR119429]
Jonathan Wakely
redi@gcc.gnu.org
Wed Mar 26 14:42:54 GMT 2025
https://gcc.gnu.org/g:65670b788d4624d54b270d51ec846d93133e5c50
commit r14-11451-g65670b788d4624d54b270d51ec846d93133e5c50
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Mon Mar 24 21:25:20 2025 +0000
libstdc++: Cast -1 to size_t in <format> [PR119429]
This avoids a runtime error from Clang's annoying -fsanitize=integer
(even though it's not undefined and behaves correctly).
libstdc++-v3/ChangeLog:
PR libstdc++/119429
* include/std/format (__format::_Scanner::_Scanner): Cast
default argument to size_t.
(cherry picked from commit 039cc50867000e6427924ca490dc810eaa44cf08)
Diff:
---
libstdc++-v3/include/std/format | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index 5720bf069b4a..f64947a0e293 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -3903,7 +3903,7 @@ namespace __format
basic_format_parse_context<_CharT> _M_pc;
constexpr explicit
- _Scanner(basic_string_view<_CharT> __str, size_t __nargs = -1)
+ _Scanner(basic_string_view<_CharT> __str, size_t __nargs = (size_t)-1)
: _M_pc(__str, __nargs)
{ }
More information about the Libstdc++-cvs
mailing list