From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 85F373857C50 for ; Fri, 19 Nov 2021 18:23:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 85F373857C50 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-184-mXbctwTnPZyI3rd_lXUx1g-1; Fri, 19 Nov 2021 13:23:12 -0500 X-MC-Unique: mXbctwTnPZyI3rd_lXUx1g-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1765D80A5C8; Fri, 19 Nov 2021 18:23:12 +0000 (UTC) Received: from localhost (unknown [10.33.36.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id AAB8760862; Fri, 19 Nov 2021 18:23:11 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Suppress -Wstringop warnings [PR103332] Date: Fri, 19 Nov 2021 18:23:10 +0000 Message-Id: <20211119182311.479430-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-Spam-Status: No, score=-14.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=unavailable autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Nov 2021 18:23:18 -0000 Tested x86_64-linux, pushed to trunk. libstdc++-v3/ChangeLog: PR libstdc++/103332 PR libstdc++/102958 * testsuite/21_strings/basic_string/capacity/char/1.cc: Add -Wno-stringop-overflow. * testsuite/21_strings/basic_string/operators/char/1.cc: Likewise. * testsuite/experimental/filesystem/path/factory/u8path-char8_t.cc: Add -Wno-stringop-overread. --- .../testsuite/21_strings/basic_string/capacity/char/1.cc | 3 +++ .../testsuite/21_strings/basic_string/operators/char/1.cc | 3 +++ .../experimental/filesystem/path/factory/u8path-char8_t.cc | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/1.cc index eea69771f79..e21181bd62c 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/1.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/1.cc @@ -17,6 +17,8 @@ // with this library; see the file COPYING3. If not see // . +// { dg-options "-Wno-stringop-overflow" } + // 21.3.3 string capacity #include @@ -59,6 +61,7 @@ void test01() std::string str05(30, 'q'); std::string str06 = str05; + // The following triggers -Wstringop-overflow. See PR 103332. str05 = str06 + str05; VERIFY( str05.capacity() >= str05.size() ); VERIFY( str06.capacity() >= str06.size() ); diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/1.cc index 3bdac19644f..514cd2dc65d 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/1.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/1.cc @@ -17,6 +17,8 @@ // with this library; see the file COPYING3. If not see // . +// { dg-options "-Wno-stringop-overflow" } + // 21.3.6 string operations #include @@ -31,6 +33,7 @@ int test01(void) // Should get this: // 1:8-chars_8-chars_ // 2:8-chars_8-chars_ + // The following triggers -Wstringop-overread. See PR 103332. str1 = std::string("8-chars_") + "8-chars_"; str1.c_str(); // printf("1:%s\n", str1.c_str()); diff --git a/libstdc++-v3/testsuite/experimental/filesystem/path/factory/u8path-char8_t.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/factory/u8path-char8_t.cc index 26b04cd1cf1..985a5f8fbc1 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/path/factory/u8path-char8_t.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/path/factory/u8path-char8_t.cc @@ -15,7 +15,7 @@ // with this library; see the file COPYING3. If not see // . -// { dg-options "-lstdc++fs -fchar8_t" } +// { dg-options "-lstdc++fs -fchar8_t -Wno-stringop-overread" } // { dg-do run { target c++11 } } // { dg-require-filesystem-ts "" } @@ -36,10 +36,12 @@ test01() p = fs::u8path(u8"\xf0\x9d\x84\x9e"); VERIFY( p.u8string() == u8"\U0001D11E" ); + // The following triggers -Wstringop-overread. See PR 103332. std::u8string s1 = u8"filename2"; p = fs::u8path(s1); VERIFY( p.u8string() == u8"filename2" ); + // The following triggers -Wstringop-overread. See PR 103332. std::u8string s2 = u8"filename3"; p = fs::u8path(s2.begin(), s2.end()); VERIFY( p.u8string() == u8"filename3" ); -- 2.31.1