public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-7628] libstdc++: Avoid warning in std::format
@ 2023-07-28 17:32 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2023-07-28 17:32 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:6302b8b7ed2e1cb67dec5d7d20e34d4c8e35161c

commit r13-7628-g6302b8b7ed2e1cb67dec5d7d20e34d4c8e35161c
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Jul 18 22:14:32 2023 +0100

    libstdc++: Avoid warning in std::format
    
    With -Wmaybe-uninitialized -Wsystem-headers there's a warning about
    creating a string_view from an uninitalized array. Initializing the
    first element of the array avoids the warning.
    
    libstdc++-v3/ChangeLog:
    
            * include/std/format (__write_padded): Initialize first element
            of array to avoid a -Wmaybe-uninitialized warning.
    
    (cherry picked from commit 2af0f4c34667efe9924fa4e3aa7b9a87617e5ccd)

Diff:
---
 libstdc++-v3/include/std/format | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index 9a3896b8339..0c6069b2681 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -610,6 +610,7 @@ namespace __format
     {
       const size_t __buflen = 0x20;
       _CharT __padding_chars[__buflen];
+      __padding_chars[0] = _CharT();
       basic_string_view<_CharT> __padding{__padding_chars, __buflen};
 
       auto __pad = [&__padding] (size_t __n, _Out& __o) {

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

only message in thread, other threads:[~2023-07-28 17:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-28 17:32 [gcc r13-7628] libstdc++: Avoid warning in std::format 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).