public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] libstdc++: Fix -Wmaybe-uninitialized false positive [PR103984]
@ 2022-03-01 15:26 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2022-03-01 15:26 UTC (permalink / raw)
  To: libstdc++, gcc-patches

Tested powerpc64le-linux, pushed to trunk.

-- >8 --

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.
---
 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; }
-- 
2.34.1


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

only message in thread, other threads:[~2022-03-01 15:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01 15:26 [committed] libstdc++: Fix -Wmaybe-uninitialized false positive [PR103984] 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).