* [committed] libstdc++: Fix test failures at -O0
@ 2022-02-11 22:15 Jonathan Wakely
2022-02-13 21:20 ` Hans-Peter Nilsson
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Wakely @ 2022-02-11 22:15 UTC (permalink / raw)
To: libstdc++, gcc-patches
Tested x86_64-linux, pushed to trunk.
-- >8 --
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.
---
.../testsuite/20_util/monotonic_buffer_resource/allocate.cc | 3 +++
.../testsuite/20_util/unsynchronized_pool_resource/allocate.cc | 3 +++
libstdc++-v3/testsuite/29_atomics/atomic/cons/user_pod.cc | 1 +
3 files changed, 7 insertions(+)
diff --git a/libstdc++-v3/testsuite/20_util/monotonic_buffer_resource/allocate.cc b/libstdc++-v3/testsuite/20_util/monotonic_buffer_resource/allocate.cc
index 015c1a9e4dc..e7a0e97c9f9 100644
--- a/libstdc++-v3/testsuite/20_util/monotonic_buffer_resource/allocate.cc
+++ b/libstdc++-v3/testsuite/20_util/monotonic_buffer_resource/allocate.cc
@@ -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;
diff --git a/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc b/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc
index c81344a20e4..25e5ce63b58 100644
--- a/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc
+++ b/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc
@@ -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;
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/user_pod.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/user_pod.cc
index c538ff370e1..285b420eef1 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic/cons/user_pod.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/user_pod.cc
@@ -1,3 +1,4 @@
+// { dg-options "-O1" }
// { dg-do link { target c++11 } }
// Copyright (C) 2009-2022 Free Software Foundation, Inc.
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [committed] libstdc++: Fix test failures at -O0
2022-02-11 22:15 [committed] libstdc++: Fix test failures at -O0 Jonathan Wakely
@ 2022-02-13 21:20 ` Hans-Peter Nilsson
2022-02-13 22:15 ` Jonathan Wakely
0 siblings, 1 reply; 3+ messages in thread
From: Hans-Peter Nilsson @ 2022-02-13 21:20 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: libstdc++, gcc-patches
On Fri, 11 Feb 2022, Jonathan Wakely via Gcc-patches wrote:
> diff --git a/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc b/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc
> index c81344a20e4..25e5ce63b58 100644
> --- a/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc
> +++ b/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc
> @@ -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
Isn't it a bug that you (presumably) didn't get an error for
that misspelling? Or a diagnostic to distinguish it? 8-}
brgds, H-P
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [committed] libstdc++: Fix test failures at -O0
2022-02-13 21:20 ` Hans-Peter Nilsson
@ 2022-02-13 22:15 ` Jonathan Wakely
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Wakely @ 2022-02-13 22:15 UTC (permalink / raw)
To: Hans-Peter Nilsson; +Cc: Jonathan Wakely, libstdc++, gcc-patches
On Sun, 13 Feb 2022, 21:21 Hans-Peter Nilsson, <hp@bitrange.com> wrote:
> On Fri, 11 Feb 2022, Jonathan Wakely via Gcc-patches wrote:
> > diff --git
> a/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc
> b/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc
> > index c81344a20e4..25e5ce63b58 100644
> > ---
> a/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc
> > +++
> b/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc
> > @@ -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
>
> Isn't it a bug that you (presumably) didn't get an error for
> that misspelling? Or a diagnostic to distinguish it? 8-}
>
Oh! I guess I typed di then ctrl-p to complete it (a vim shortcut).
I think it should warn with -Wunknown-pragma or whatever the option is, but
we probably don't use that for the libstdc++ tests.
I'll fix that in the morning, thanks for spotting it.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-13 22:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-11 22:15 [committed] libstdc++: Fix test failures at -O0 Jonathan Wakely
2022-02-13 21:20 ` Hans-Peter Nilsson
2022-02-13 22:15 ` Jonathan Wakely
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).