public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] libstdc++: Avoid -Wmaybe-uninitialized warnings in text_encoding.cc
@ 2024-01-18 12:54 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2024-01-18 12:54 UTC (permalink / raw)
  To: libstdc++, gcc-patches

Tested x86_64-linux. Pushed to trunk.

-- >8 --

These variables are only read from if we haven't reached the end of
either range, in which case they're guaranteed to be initialized to the
next alphanumeric character. But we can just initialize them to make the
compiler happy.

libstdc++-v3/ChangeLog:

	* include/bits/unicode.h (__charset_alias_match): Initialize
	__var_a and __var_b.
---
 libstdc++-v3/include/bits/unicode.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/bits/unicode.h b/libstdc++-v3/include/bits/unicode.h
index d025d21f3dd..51bf02e927f 100644
--- a/libstdc++-v3/include/bits/unicode.h
+++ b/libstdc++-v3/include/bits/unicode.h
@@ -1084,7 +1084,7 @@ inline namespace __v15_1_0
     while (true)
       {
 	// Find the value of the next alphanumeric character in each string.
-	unsigned char __val_a, __val_b;
+	unsigned char __val_a{}, __val_b{};
 	while (__ptr_a != __end_a
 		 && (__val_a = __map(*__ptr_a, __num_a)) == 127)
 	  ++__ptr_a;
-- 
2.43.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-18 12:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-18 12:54 [committed] libstdc++: Avoid -Wmaybe-uninitialized warnings in text_encoding.cc Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).