On 03/12/2025 12:16, Andrew Stubbs wrote:
So, something in [libgomp_target_compile "" "" "none" $options] changes
the behaviour of subsequent compile tests????
I've not yet figured out why that happens.
I've found where it was messing with global state. The patch is attached.
I think it would have worked if the dg-excess-errors directive had come
before the dg-additional-sources, but in general using the
offload_target checks in any way would break any test that has
additional sources.
OK for mainline?
Andrew
From e040c31d54e5b165ce556d1ed325057405029a60 Mon Sep 17 00:00:00 2001
From: Andrew Stubbs <[email protected]>
Date: Wed, 3 Dec 2025 14:34:59 +0000
Subject: [PATCH] libgomp: Fix offload_target with additional sources
The offload_target_* effective target checks called libgomp_target_compile in a
way that altered global state if additional sources were configured.
This patch ignores additional sources if the compile check uses no sources (a
compiler probe, only), thus fixing the problem.
libgomp/ChangeLog:
* testsuite/lib/libgomp.exp (libgomp_target_compile): Don't use
additional sources if there are no primary sources.
---
libgomp/testsuite/lib/libgomp.exp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
index f5683b50725..2fc811d91c6 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -295,7 +295,9 @@ proc libgomp_target_compile { source dest type options } {
set options [concat "$ALWAYS_CFLAGS" $options]
}
- set options [dg-additional-files-options $options $source $dest $type]
+ if { $source != "" } {
+ set options [dg-additional-files-options $options $source $dest $type]
+ }
set result [target_compile $source $dest $type $options]
--
2.51.0