public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r14-8225] libstdc++: Avoid -Wmaybe-uninitialized warnings in text_encoding.cc
Date: Thu, 18 Jan 2024 12:54:31 +0000 (GMT)	[thread overview]
Message-ID: <20240118125431.5FC49385DC3A@sourceware.org> (raw)

https://gcc.gnu.org/g:ac913d5d518604c5baf7274bed76e3ff8f3e4c08

commit r14-8225-gac913d5d518604c5baf7274bed76e3ff8f3e4c08
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Jan 18 12:40:52 2024 +0000

    libstdc++: Avoid -Wmaybe-uninitialized warnings in text_encoding.cc
    
    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.

Diff:
---
 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;

                 reply	other threads:[~2024-01-18 12:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240118125431.5FC49385DC3A@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).