[libgomp,testsuite] Don't shadow global 'offload_targets' variable (was: [patch, libgomp] Add tests for print from offload target)

Message ID 875yzgthbq.fsf@euler.schwinge.homeip.net
State New
Headers show
Series
  • [libgomp,testsuite] Don't shadow global 'offload_targets' variable (was: [patch, libgomp] Add tests for print from offload target)
Related show

Commit Message

Thomas Schwinge May 18, 2021, 11:24 a.m.
Hi!

On 2019-11-27T18:54:45+0100, I wrote:
> On 2019-11-14T18:22:39+0100, Jakub Jelinek <jakub@redhat.com> wrote:

>> On Thu, Nov 14, 2019 at 05:18:41PM +0000, Andrew Stubbs wrote:

>>> On 14/11/2019 17:05, Jakub Jelinek wrote:

>>> > On Thu, Nov 14, 2019 at 04:47:49PM +0000, Andrew Stubbs wrote:

>>> > > This patch [...]


> Note that for libgomp OpenMP testing [...] means FAIL as soon as nvptx

> plus possibly any other offload targets are configured, as we will always

> compile for all offload targets, as no specific '-foffload' gets passed

> -- in contrast to the libgomp OpenACC testing.  (Changing that would be a

> separate discussion.)


> To fix [...], I'm adding

> 'check_effective_target_offload_target_nvptx' to generally test whether

> "compiling for offload target nvptx", [...]


(Later bug-fixed and generalized by Tobias -- thanks, belatedly!)

> Committed "Fix 'libgomp.fortran/target-print-1.f90',

> 'libgomp.oacc-fortran/print-1.f90' for offload target nvptx" to trunk in

> r278779, see attached.


> --- a/libgomp/testsuite/lib/libgomp.exp

> +++ b/libgomp/testsuite/lib/libgomp.exp


> +# Return 1 if compiling for offload target nvptx.

> +proc check_effective_target_offload_target_nvptx { } {

> +    [...]

> +    if [regexp "(?n)^OFFLOAD_TARGET_NAMES=(.*)" $gcc_output dummy offload_targets] {

> +     verbose "compiling for offload targets: $offload_targets"

> +     return [string match "*:nvptx*:*" ":$offload_targets:"]

> +    }

> +    [...]

> +}


As a clean-up (no behavioral change), I've now pushed
"[libgomp, testsuite] Don't shadow global 'offload_targets' variable" to
master branch in commit b5c3145ad9ac04654d4947d34d1e9dc5c26f4c53, see
attached.


Grüße
 Thomas


-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf

Patch

From b5c3145ad9ac04654d4947d34d1e9dc5c26f4c53 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Mon, 27 Apr 2020 08:22:36 +0200
Subject: [PATCH] [libgomp, testsuite] Don't shadow global 'offload_targets'
 variable

See local 'offload_targets' variable in
'libgomp/testsuite/lib/libgomp.exp:libgomp_check_effective_target_offload_target'
vs. global 'libgomp/testsuite/libgomp-test-support.exp.in:offload_targets'
variable.

	libgomp/
	* testsuite/lib/libgomp.exp
	(check_effective_target_offload_target_nvptx): Don't shadow global
	'offload_targets' variable.
---
 libgomp/testsuite/lib/libgomp.exp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
index 46cce9b8445..089c2bba9fc 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -354,9 +354,9 @@  proc libgomp_check_effective_target_offload_target { target_name } {
     # decides.  This is somewhat modelled after
     # 'gcc/testsuite/lib/target-supports.exp:check_configured_with'.
     set gcc_output [libgomp_target_compile "" "" "none" $options]
-    if [regexp "(?n)^OFFLOAD_TARGET_NAMES=(.*)" $gcc_output dummy offload_targets] {
-	verbose "compiling for offload targets: $offload_targets"
-	return [string match "*:$target_name*:*" ":$offload_targets:"]
+    if [regexp "(?n)^OFFLOAD_TARGET_NAMES=(.*)" $gcc_output dummy gcc_offload_targets] {
+	verbose "compiling for offload targets: $gcc_offload_targets"
+	return [string match "*:$target_name*:*" ":$gcc_offload_targets:"]
     }
 
     verbose "not compiling for $target_name offload target"
-- 
2.30.2