Andrew Stubbs wrote:
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?

LGTM – albeit I wonder whether that shows up also at other
testsuite; I wonder whether it would make sense to file a
PR about this?

* * *

Regarding the:

/* { dg-excess-errors "Unified Shared Memory is enabled, but XNACK is disabled" 
{ target offload_target_amdgcn } } */

I think it is unfortunate that all errors in this files are
ignored if GCC is configured for amdgcn offloading, just because
the single -march= gfx908 has issues.

I wonder whether we could use the 'include-opts' of dg-xfail-if
to get this matching  -foffload.*-march=gfx908 ?

* * *

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 {
...
-    set options [dg-additional-files-options $options $source $dest $type]
+    if { $source != "" } {
+        set options [dg-additional-files-options $options $source $dest $type]
+    }


Tobias

Reply via email to