[gcc r17-2893] testsuite/g++: force the serial PSTL backend in xtreme-header-8.C

Kyrylo Tkachov via Gcc-cvs <[email protected]> Mon, 3 Aug 2026 08:30:14 +0000 (GMT)
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:ee279a78b29516a10a4a45ae54a66810f2945bdc

commit r17-2893-gee279a78b29516a10a4a45ae54a66810f2945bdc
Author: Kyrylo Tkachov <[email protected]>
Date:   Sun Jul 26 05:18:56 2026 -0700

    testsuite/g++: force the serial PSTL backend in xtreme-header-8.C
    
    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.
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/modules/xtreme-header-8.C: Select the serial PSTL
            backend.
    
    Signed-off-by: Kyrylo Tkachov <[email protected]>

Diff:
---
 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 dc8ae240ffe1..013fbb83c423 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 } }