From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 82F423858C83; Tue, 1 Mar 2022 15:26:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 82F423858C83 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 r12-7434] libstdc++: Fix -Wmaybe-uninitialized false positive [PR103984] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 16ced9c654e39e75b8de14802a173a2c7aff4e47 X-Git-Newrev: ad66b03b3c84786e73e73f09be19977b8f3c4ea3 Message-Id: <20220301152614.82F423858C83@sourceware.org> Date: Tue, 1 Mar 2022 15:26:14 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Mar 2022 15:26:14 -0000 https://gcc.gnu.org/g:ad66b03b3c84786e73e73f09be19977b8f3c4ea3 commit r12-7434-gad66b03b3c84786e73e73f09be19977b8f3c4ea3 Author: Jonathan Wakely Date: Tue Mar 1 09:33:21 2022 +0000 libstdc++: Fix -Wmaybe-uninitialized false positive [PR103984] This fixes a false positive warning seen with LTO: 12/bits/regex_compiler.tcc:443:32: error: '__last_char._M_char' may be used uninitialized [-Werror=maybe-uninitialized] Given that the std::regex code is not very efficient anyway, the overhead of initializing this byte should be minimal. libstdc++-v3/ChangeLog: PR middle-end/103984 * include/bits/regex_compiler.h (_BracketMatcher::_M_char): Use default member initializer. Diff: --- libstdc++-v3/include/bits/regex_compiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libstdc++-v3/include/bits/regex_compiler.h b/libstdc++-v3/include/bits/regex_compiler.h index 174aefe75f7..348c170c81a 100644 --- a/libstdc++-v3/include/bits/regex_compiler.h +++ b/libstdc++-v3/include/bits/regex_compiler.h @@ -125,7 +125,7 @@ namespace __detail struct _BracketState { enum class _Type : char { _None, _Char, _Class } _M_type = _Type::_None; - _CharT _M_char; + _CharT _M_char = _CharT(); void set(_CharT __c) noexcept { _M_type = _Type::_Char; _M_char = __c; }