[gcc r16-4268] libstdc++: Initialize local variable in __gnu_cxx::rope

Jonathan Wakely redi@gcc.gnu.org
Tue Oct 7 11:16:33 GMT 2025


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

commit r16-4268-ga06d127372d935fdea6389d456350257c3b30184
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Oct 1 15:12:35 2025 +0100

    libstdc++: Initialize local variable in __gnu_cxx::rope
    
    This avoids -Wmaybe-uninitialized warnings.
    
    libstdc++-v3/ChangeLog:
    
            * include/ext/ropeimpl.h (rope::_S_fetch): Initialize variable.

Diff:
---
 libstdc++-v3/include/ext/ropeimpl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/ext/ropeimpl.h b/libstdc++-v3/include/ext/ropeimpl.h
index 320192706ff9..00b334cb4f4e 100644
--- a/libstdc++-v3/include/ext/ropeimpl.h
+++ b/libstdc++-v3/include/ext/ropeimpl.h
@@ -1355,7 +1355,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	    case __detail::_S_substringfn:
 	      {
 		_RopeFunction* __f = (_RopeFunction*)__r;
-		_CharT __result;
+		_CharT __result = _CharT();
 
 		(*(__f->_M_fn))(__i, 1, &__result);
 		return __result;


More information about the Libstdc++-cvs mailing list