From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 15B1E3857739; Wed, 19 Jul 2023 11:37:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 15B1E3857739 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689766659; bh=KFY1aBAa0caRuszhag1b2PqUy7xi/UHwMvZwc6tg69k=; h=From:To:Subject:Date:From; b=iuksMJ/ycwMfFIi7sVTtSNaUVeWztDM8zKnRT20V6tNa1cmC6IIOidMcCP2e8xIRB CsN6x9QTsoykyG+xUUWqYl4r2BG+1s/Gm7vBFgSwgIvjqSz4fEl3dVsjUmWNPe8kdk A2WQN4j7hF8RzN8ST1At9H1vEeNclwvoapS5Rn8A= 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 r14-2641] libstdc++: Avoid warning in std::format X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: f4bce119f617dc4663fb43f55784908daf16b4b6 X-Git-Newrev: 2af0f4c34667efe9924fa4e3aa7b9a87617e5ccd Message-Id: <20230719113739.15B1E3857739@sourceware.org> Date: Wed, 19 Jul 2023 11:37:39 +0000 (GMT) List-Id: https://gcc.gnu.org/g:2af0f4c34667efe9924fa4e3aa7b9a87617e5ccd commit r14-2641-g2af0f4c34667efe9924fa4e3aa7b9a87617e5ccd Author: Jonathan Wakely 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) {