From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 1F17C385C411; Fri, 19 Nov 2021 18:16:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F17C385C411 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 r12-5414] libstdc++: Suppress -Wstringop warnings [PR103332] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 2d76292bd6719d687bc77051da265df8ed7f5a61 X-Git-Newrev: b8f2efaed02e8b03d215d74e42d3707761772f64 Message-Id: <20211119181634.1F17C385C411@sourceware.org> Date: Fri, 19 Nov 2021 18:16:34 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Nov 2021 18:16:34 -0000 https://gcc.gnu.org/g:b8f2efaed02e8b03d215d74e42d3707761772f64 commit r12-5414-gb8f2efaed02e8b03d215d74e42d3707761772f64 Author: Jonathan Wakely Date: Fri Nov 19 18:13:10 2021 +0000 libstdc++: Suppress -Wstringop warnings [PR103332] 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. Diff: --- libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/1.cc | 3 +++ libstdc++-v3/testsuite/21_strings/basic_string/operators/char/1.cc | 3 +++ .../testsuite/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" );