]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix test failures at -O0
authorJonathan Wakely <jwakely@redhat.com>
Fri, 11 Feb 2022 21:17:05 +0000 (21:17 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 11 Feb 2022 21:41:43 +0000 (21:41 +0000)
libstdc++-v3/ChangeLog:

* testsuite/20_util/monotonic_buffer_resource/allocate.cc:
Ignore -Walloc-larger-than warning.
* testsuite/20_util/unsynchronized_pool_resource/allocate.cc:
Likewise.
* testsuite/29_atomics/atomic/cons/user_pod.cc: Compile with -O1
to avoid linker error for __atomic_is_lock_free.

libstdc++-v3/testsuite/20_util/monotonic_buffer_resource/allocate.cc
libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc
libstdc++-v3/testsuite/29_atomics/atomic/cons/user_pod.cc

index 015c1a9e4dc115e9c4406e4643d0dbf6188f0366..e7a0e97c9f9fc0a9abe4a6bf361ffcb2cfafe7a4 100644 (file)
@@ -238,8 +238,11 @@ test07()
   std::pmr::monotonic_buffer_resource mbr(&cr);
   try
   {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Walloc-size-larger-than="
     // Try to allocate a ridiculous size:
     void* p = mbr.allocate(std::size_t(-2), 1);
+#pragma GCC diagnostic pop
     // Should not reach here!
     VERIFY( !"attempt to allocate SIZE_MAX-1 should not have succeeded" );
     throw p;
index c81344a20e4572398c472d5c77e34ce8e661deb2..25e5ce63b588ad9d3b0d9abd27f967475fc693a9 100644 (file)
@@ -281,10 +281,13 @@ test07()
   std::pmr::unsynchronized_pool_resource upr(&cr);
   try
   {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Walloc-size-larger-than="
     // Try to allocate a ridiculous size (and use a large extended alignment
     // so that careful_resource::do_allocate can distinguish this allocation
     // from any required for the pool resource's internal data structures):
     void* p = upr.allocate(std::size_t(-2), 1024);
+#pragma GCC distinguish pop
     // Should not reach here!
     VERIFY( !"attempt to allocate SIZE_MAX-1 should not have succeeded" );
     throw p;
index c538ff370e1cfdc85ececc2f0af7b9d4bcbec8ac..285b420eef15cd8a2865e291ea4ddea93d1c0f1b 100644 (file)
@@ -1,3 +1,4 @@
+// { dg-options "-O1" }
 // { dg-do link { target c++11 } }
 
 // Copyright (C) 2009-2022 Free Software Foundation, Inc.