Re: [PATCH] testsuite/g++: force the serial PSTL backend in xtreme-header-8.C

Jonathan Wakely <[email protected]> Mon, 3 Aug 2026 09:21:01 +0100
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.libstdc++.devel
Message-ID <CAH6eHdQDq2uF1Owp=A+vYfvabf6xsK4eT=6PP+_u1ft+9nqrrw@mail.gmail.com>
I can't approve changes to the g++ tests but this seems sensible to me.



On Mon, 27 Jul 2026, 12:41 , <[email protected]> wrote:

> From: Kyrylo Tkachov <[email protected]>
>
> xtreme-header-8.C is the only xtreme-header test that builds a named
> module, so [basic.link]/17 applies to it and exposing a TU-local entity
> is ill-formed.  libstdc++ selects the PSTL backend from
> __has_include(<tbb/tbb.h>), so on a machine with oneTBB installed
> <execution> pulls third-party headers into the module purview.  oneTBB
> names namespace-scope statics and constants from inline member functions
> of externally linked classes, which GCC correctly rejects, and the test
> fails for reasons that have nothing to do with libstdc++ or the modules
> implementation.
>
> The failure dates back to r15-6379-g0c2ae3843261 ("c++/modules: Ignore
> TU-local entities where necessary"), which added the test.  The exposure
> diagnostic already existed then, so the test has failed on a host with
> oneTBB installed since the day it landed.  That commit message does note
> the hazard, "unfortunately the system headers on some
> targets declare TU-local entities", but the third-party headers reached
> through <execution> were not considered.
>
> _GLIBCXX_USE_TBB_PAR_BACKEND is a documented user-overridable knob, and
> libstdc++ already suppresses the TBB backend the same way for module std
> (r15-5366-g7db55c0ba1ba).  Define it to 0 so the test exercises what it
> is meant to exercise regardless of what happens to be installed on the
> test machine.
>
> Tested on aarch64-none-linux-gnu.
> Ok for trunk?
> Thanks,
> Kyrill
>
> gcc/testsuite/ChangeLog:
>
>         * g++.dg/modules/xtreme-header-8.C: Select the serial PSTL
>         backend.
>
> Signed-off-by: Kyrylo Tkachov <[email protected]>
> ---
>  gcc/testsuite/g++.dg/modules/xtreme-header-8.C | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-8.C
> b/gcc/testsuite/g++.dg/modules/xtreme-header-8.C
> index dc8ae240ffe..013fbb83c42 100644
> --- a/gcc/testsuite/g++.dg/modules/xtreme-header-8.C
> +++ b/gcc/testsuite/g++.dg/modules/xtreme-header-8.C
> @@ -1,5 +1,8 @@
>  // PR c++/115126
> -// { dg-additional-options "-fmodules-ts -Wtemplate-names-tu-local" }
> +// Force the serial PSTL backend.  If oneTBB is installed, <execution>
> +// pulls third-party headers that expose TU-local entities into the
> +// module purview, which is ill-formed in a module interface unit.
> +// { dg-additional-options "-fmodules-ts -Wtemplate-names-tu-local
> -D_GLIBCXX_USE_TBB_PAR_BACKEND=0" }
>  // { dg-module-cmi xstd }
>  // { dg-skip-if "required hosted libstdc++ for any in xtreme-header.h" {
> ! hostedlib } }
>
> --
> 2.50.1 (Apple Git-155)
>
>