public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Christophe Lyon <christophe.lyon@linaro.org>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org,
	kyrylo.tkachov@arm.com,  richard.earnshaw@arm.com
Subject: Re: [PATCH 2/2] libstdc++: Add dg-require-thread-fence in several tests
Date: Mon, 11 Sep 2023 14:36:11 +0200	[thread overview]
Message-ID: <CAPS5khZt_jmS=71w-VhFbN_vB7R_=kB5vPOu5bQUPeo+ePXm-A@mail.gmail.com> (raw)
In-Reply-To: <CACb0b4nNHCThGae7bV9vjp299+i-VN-JzVNuZCbt5nnLZrRhkg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 5660 bytes --]

On Mon, 11 Sept 2023 at 12:59, Jonathan Wakely <jwakely@redhat.com> wrote:

> On Sun, 10 Sept 2023 at 20:31, Christophe Lyon
> <christophe.lyon@linaro.org> wrote:
> >
> > Some targets like arm-eabi with newlib and default settings rely on
> > __sync_synchronize() to ensure synchronization.  Newlib does not
> > implement it by default, to make users aware they have to take special
> > care.
> >
> > This makes a few tests fail to link.
>
> Does this mean those features are unusable on the target, or just that
> users need to provide their own __sync_synchronize to use them?
>

IIUC the user is expected to provide them.
Looks like we discussed this in the past :-)
In  https://gcc.gnu.org/legacy-ml/gcc-patches/2016-10/msg01632.html,
see the pointer to Ramana's comment:
https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02751.html

The default arch for arm-eabi is armv4t which is very old.
When running the testsuite with something more recent (either as default by
configuring GCC --with-arch=XXX or by forcing -march/-mcpu via
dejagnu's target-board), the compiler generates barrier instructions and
there are no such errors.

For instance, here is a log with the defaults:
https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-arm_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-arm_eabi
and a log when we target cortex-m0 which is still a very small cpu but has
barriers:
https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi

I somehow wanted to get rid of such errors with the default
configuration....


> >
> > This patch requires the missing thread-fence effective target in the
> > tests that need it, making them UNSUPPORTED instead of FAIL and
> > UNRESOLVED.
>
> Some of the modified tests should not be using
> __gnu_debug::_Safe_sequence_base::_M_detach_all(), because they don't
> use the Debug Mode. I don't know where those linker errors come from.
> For example, the 23_containers/span/*assert_neg.cc and
> 26_numerics/valarray/* tests shouldn't use debug iterators or atomics.
> Neither should 25_algorithms/sample/2.cc nor
> 26_numerics/bit/bit.pow.two/bit_ceil_neg.cc
>

Ouch!  I had the feeling this patch wouldn't count as obvious :-)

I confess I didn't analyze the linker map for every single test updated by
this patch....
I can have a deeper look based on your comment below, excluding those that
look "OK"


> The last three in the patch shouldn't use it either:
>
> > diff --git
> a/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
> b/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
> > index cb818708aef..372ed6e0c00 100644
> > --- a/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
> > +++ b/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
> > @@ -18,6 +18,7 @@
> >  // { dg-do run { target c++14 } }
> >  // { dg-add-options libatomic }
> >  // { dg-xfail-if "poll not available" { *-*-rtems* } }
> > +// { dg-require-thread-fence "" } // needed by
> __gnu_debug::_Safe_sequence_base::_M_detach_all()
> >
> >  #include <experimental/timer>
> >  #include <testsuite_hooks.h>
> > diff --git
> a/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
> b/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
> > index ae51979c3b4..8383e0be6a4 100644
> > --- a/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
> > +++ b/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
> > @@ -18,6 +18,7 @@
> >  // { dg-do run { target c++14 } }
> >  // { dg-add-options libatomic }
> >  // { dg-xfail-if "poll not available" { *-*-rtems* } }
> > +// { dg-require-thread-fence "" } // needed by
> __gnu_debug::_Safe_sequence_base::_M_detach_all()
> >
> >  #include <experimental/timer>
> >  #include <testsuite_hooks.h>
> > diff --git
> a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
> b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
> > index 960c1d253b5..42de45619a8 100644
> > ---
> a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
> > +++
> b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
> > @@ -16,6 +16,7 @@
> >  // <http://www.gnu.org/licenses/>.
> >
> >  // { dg-do run { target c++14 } }
> > +// { dg-require-thread-fence "" } // needed by
> __gnu_debug::_Safe_sequence_base::_M_detach_all()
> >
> >  #include <experimental/memory_resource>
> >  #include <utility>
>
>
> I'm concerned with how much of the testsuite is being completely
> disabled for this target.
>
I think that depends on which "flavour" of arm-eabi we are looking at.
I'm trying to cleanup some of the "obvious" failures, and that proves to be
tedious:
- quite a few gcc/g++ tests have problems when overriding -mcpu/-march with
dejagnu's target-board
- so I thought a first step could be to clean the default configuration,
but as said above it targets a very old architecture


>
> Any tests with "debug" in the path are probably relying on the debug
> mode, and any that use -D_GLIBCXX_DEBUG in dg-options are. And I
> suppose it's expected that 29_atomics/* tests rely on atomic
> synchronization, but it's unfortunate that those now can't be tested
> for arm-eabi, and I don't understand why it only affects eight of the
>
that's only the "default" arm-eabi, it does not happen in other non-default
arm-eabi (well I didn't check all possible cases)


> atomics tests not all the other ones.
>
> Something doesn't seem right here.
>
>
Thanks,

Christophe

  reply	other threads:[~2023-09-11 12:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-10 19:30 [PATCH 1/2] testsuite: Add and use thread_fence effective-target Christophe Lyon
2023-09-10 19:30 ` [PATCH 2/2] libstdc++: Add dg-require-thread-fence in several tests Christophe Lyon
2023-09-11 10:59   ` Jonathan Wakely
2023-09-11 12:36     ` Christophe Lyon [this message]
2023-09-11 13:10       ` Jonathan Wakely
2023-09-11 13:57         ` Christophe Lyon
2023-09-11 15:22           ` Jonathan Wakely
2023-09-11 15:27             ` Richard Earnshaw (lists)
2023-09-11 15:39             ` Christophe Lyon
2023-09-11 16:11               ` Jonathan Wakely
2023-09-12  7:59                 ` Christophe Lyon
2023-09-12  9:07                   ` Jonathan Wakely
2023-09-13 15:37                     ` Christophe Lyon
2023-09-13 15:56                       ` Jonathan Wakely
2023-09-14  9:09                         ` [PATCH v2 " Christophe Lyon
2023-09-14  9:25                           ` Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPS5khZt_jmS=71w-VhFbN_vB7R_=kB5vPOu5bQUPeo+ePXm-A@mail.gmail.com' \
    --to=christophe.lyon@linaro.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely@redhat.com \
    --cc=kyrylo.tkachov@arm.com \
    --cc=libstdc++@gcc.gnu.org \
    --cc=richard.earnshaw@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).