On Wed, Feb 11, 2026 at 01:00:29PM +0100, Jakub Jelinek wrote:
> This regressed pretty much all the libitm tests in our distro testing.
> See below.  Testing with make check 
> RUNTESTFLAGS=--target_board=unix/-fstack-protector-strong
> works though, so it is not about the extra option, but about modifying
> variables which are not reset to their previous values.
> So I think any testing where libitm.exp runs the c.exp tests, then c++.exp
> tests and then c.exp tests with a different set of flags will be broken.
> Looking at the log file, the first alloc-1.c compilation is
> Executing on host: /home/jakub/src/gcc/obj92/gcc/xgcc 
> -B/home/jakub/src/gcc/obj92/gcc/  
> ../../../../libitm/testsuite/libitm.c/alloc-1.c   
> -B/home/jakub/src/gcc/obj92/x86_64-pc-linux-gnu/./libitm/ 
> -I/home/jakub/src/gcc/obj92/x86_64-pc-linux-gnu/./libitm 
> -I../../../../libitm/testsuite/.. -fmessage-length=0 -fgnu-tm 
> -fdiagnostics-color=never  -O2   
> -L/home/jakub/src/gcc/obj92/x86_64-pc-linux-gnu/./libitm/.libs -lm  -o 
> ./alloc-1.exe    (timeout = 300)
> but the second one is
> Executing on host: /home/jakub/src/gcc/obj92/gcc/xgcc 
> -B/home/jakub/src/gcc/obj92/gcc/  
> ../../../../libitm/testsuite/libitm.c/alloc-1.c  -fstack-protector-strong  
> -B/home/jakub/src/gcc/obj92/x86_64-pc-linux-gnu/./libitm/ 
> -I/home/jakub/src/gcc/obj92/x86_64-pc-linux-gnu/./libitm 
> -I../../../../libitm/testsuite/.. -fmessage-length=0 -fgnu-tm 
> -fdiagnostics-color=never  -O2   
> -L/home/jakub/src/gcc/obj92/x86_64-pc-linux-gnu/./libitm/.libs -shared-libgcc 
> -lstdc++ -lm  -o ./alloc-1.exe    (timeout = 300)
> So, in addition to -fstack-protector-strong added (that is expected and
> correct) it also adds -shared-libgcc -lstdc++ and that is obviously not
> correct.
> 
> make check RUNTESTFLAGS='--target_board=unix\{,-fstack-protector-strong\}'

The following patch fixes that.

Note, I'm not sure if the installed testing path works correctly, some of
these vars are overridden regardless of whether $blddir != "" or not and
while if it is "", we bail out early (but also that path doesn't restore
those vars) unless GXX_UNDER_TEST is set, if it is set it might be also
unset.
So perhaps further changes are needed, maybe move
# The C++ tests should be linked with g++, which defaults to -shared-libgcc.
# Doing that is currently too intrusive, so hardcode here.
set lang_link_flags "-shared-libgcc -lstdc++"
set lang_library_path "../libstdc++-v3/src/.libs"
after the early returns and unset them regardless of $blddir.

2026-02-11  Jakub Jelinek  <[email protected]>

        PR libitm/69018
        * testsuite/libitm.c++/c++.exp: Unset lang_link_flags at the end.

--- libitm/testsuite/libitm.c++/c++.exp.jj      2026-01-31 10:16:31.988164142 
+0100
+++ libitm/testsuite/libitm.c++/c++.exp 2026-02-11 13:07:48.880743345 +0100
@@ -66,6 +66,7 @@ dg-runtest $tests "" ""
 
 if { $blddir != "" } {
     unset lang_include_flags
+    unset lang_link_flags
     unset lang_library_path
     unset lang_library_paths
 }

        Jakub

Reply via email to