From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 5FC49385DC3A; Thu, 18 Jan 2024 12:54:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5FC49385DC3A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705582471; bh=TMRLvCKVRfpiWeTMQNrz7V0hSYVF1sIBwvCruUWM2KQ=; h=From:To:Subject:Date:From; b=l3jXE7Re2vGbMrw2w/wwX7jSRS5XWSqQOWakFf/lZD6G6DgQgIkic0fFWY/jKteVN fUTxRCJd8Keo2wCKP8ulHvMQ+VgKYkuNErUcLe+dC5t3CUQSw+ATMhx/FUBbCbAbBG Hd2pbovAk1sEXaj4Dncqivhfz1LJYnXr3us+T7Bs= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r14-8225] libstdc++: Avoid -Wmaybe-uninitialized warnings in text_encoding.cc X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: db42a0a98916340af33338c08e6a7d328121b958 X-Git-Newrev: ac913d5d518604c5baf7274bed76e3ff8f3e4c08 Message-Id: <20240118125431.5FC49385DC3A@sourceware.org> Date: Thu, 18 Jan 2024 12:54:31 +0000 (GMT) List-Id: https://gcc.gnu.org/g:ac913d5d518604c5baf7274bed76e3ff8f3e4c08 commit r14-8225-gac913d5d518604c5baf7274bed76e3ff8f3e4c08 Author: Jonathan Wakely 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;