public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r14-2641] libstdc++: Avoid warning in std::format
Date: Wed, 19 Jul 2023 11:37:39 +0000 (GMT)	[thread overview]
Message-ID: <20230719113739.15B1E3857739@sourceware.org> (raw)

https://gcc.gnu.org/g:2af0f4c34667efe9924fa4e3aa7b9a87617e5ccd

commit r14-2641-g2af0f4c34667efe9924fa4e3aa7b9a87617e5ccd
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.

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 9d5981e4882..9710bff3c03 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) {

                 reply	other threads:[~2023-07-19 11:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230719113739.15B1E3857739@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).