For real offloading compilers, the configure-time ENABLE_OFFLOAD
macro is set to true.  If it is set, some additional code paths
are enabled – which can affect code generation with -fopenmp/-fopenacc.

As the PR shows, this can make differences for passing/failing a
testcase. – In principle, it is supposed to *pass* with ENABLE_OFFLOAD
but until the PR is fixed, XFAIL those test cases.

OK for the trunk and GCC 10?
(The patches causing the to-be-xfailed issue will be backported.)

Tobias

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander 
Walter
testsuite: Add offloading_enabled check and use it for xfail (PR95622)

gcc/testsuite/ChangeLog:

	PR middle-end/95622
	* lib/target-supports.exp (check_effective_target_offloading_enabled):
	New.
	* c-c++-common/goacc/kernels-alias-ipa-pta-2.c: Use it for xfail.
	* c-c++-common/goacc/kernels-alias-ipa-pta-4.c: Likewise.
	* c-c++-common/goacc/kernels-alias-ipa-pta.c: Likewise.

diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-alias-ipa-pta-2.c b/gcc/testsuite/c-c++-common/goacc/kernels-alias-ipa-pta-2.c
index f16d698af0d..1f62337ff51 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-alias-ipa-pta-2.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-alias-ipa-pta-2.c
@@ -32,6 +32,7 @@ foo (void)
   free (c);
 }
 
-/* { dg-final { scan-tree-dump-times "(?n)= 0;$" 2 "optimized" } } */
+/* XFAIL: see PR middle-end/95622; fails if ENABLE_OFFLOAD is set.  */
+/* { dg-final { scan-tree-dump-times "(?n)= 0;$" 2 "optimized" { xfail offloading_enabled } } } */
 /* { dg-final { scan-tree-dump-times "(?n)= 1;$" 1 "optimized" } } */
 /* { dg-final { scan-tree-dump-times "(?n)= \\*a" 0 "optimized" } } */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-alias-ipa-pta-4.c b/gcc/testsuite/c-c++-common/goacc/kernels-alias-ipa-pta-4.c
index 20b21dcb577..d7bc6cd6ff1 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-alias-ipa-pta-4.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-alias-ipa-pta-4.c
@@ -16,6 +16,7 @@ foo (void)
   }
 }
 
-/* { dg-final { scan-tree-dump-times "(?n)= 0;$" 2 "optimized" } } */
+/* XFAIL: see PR middle-end/95622; fails if ENABLE_OFFLOAD is set.  */
+/* { dg-final { scan-tree-dump-times "(?n)= 0;$" 2 "optimized" { xfail offloading_enabled } } } */
 /* { dg-final { scan-tree-dump-times "(?n)= 1;$" 1 "optimized" } } */
-/* { dg-final { scan-tree-dump-times "(?n)= \\*_\[0-9\];$" 0 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "(?n)= \\*_\[0-9\];$" 0 "optimized" { xfail offloading_enabled } } } */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-alias-ipa-pta.c b/gcc/testsuite/c-c++-common/goacc/kernels-alias-ipa-pta.c
index 969b466e8a8..a6339283876 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-alias-ipa-pta.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-alias-ipa-pta.c
@@ -18,6 +18,7 @@ foo (void)
   }
 }
 
-/* { dg-final { scan-tree-dump-times "(?n)= 0;$" 2 "optimized" } } */
+/* XFAIL: see PR middle-end/95622; fails if ENABLE_OFFLOAD is set.  */
+/* { dg-final { scan-tree-dump-times "(?n)= 0;$" 2 "optimized" { xfail offloading_enabled } } } */
 /* { dg-final { scan-tree-dump-times "(?n)= 1;$" 1 "optimized" } } */
 /* { dg-final { scan-tree-dump-times "(?n)= \\*_\[0-9\]\\\[0\\\];$" 0 "optimized" } } */
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 4dbeccd8346..862a0735b49 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -997,6 +997,12 @@ proc check_effective_target_fgraphite {} {
     } "-O1 -fgraphite"]
 }
 
+# Return 1 if compiled with --enable-offload-targets=
+# This affects host compilation as ENABLE_OFFLOAD then evaluates to true.
+proc check_effective_target_offloading_enabled {} {
+    return [check_configured_with "--enable-offload-targets"]
+}
+
 # Return 1 if compilation with -fopenacc is error-free for trivial
 # code, 0 otherwise.
 

Reply via email to