From 687091257820f4a6a005186437917270ecd27416 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Thu, 27 Jan 2022 14:17:28 +0100
Subject: [PATCH] Add 'gfortran.dg/goacc-gomp/pr102330-{1,2,3}.f90' [PR102330]

..., currently XFAILed with 'dg-ice'.

	PR middle-end/102330
	gcc/testsuite/
	* gfortran.dg/goacc-gomp/pr102330-1.f90: New file.
	* gfortran.dg/goacc-gomp/pr102330-2.f90: Likewise.
	* gfortran.dg/goacc-gomp/pr102330-3.f90: Likewise.
---
 .../gfortran.dg/goacc-gomp/pr102330-1.f90     | 20 +++++++++++++++++
 .../gfortran.dg/goacc-gomp/pr102330-2.f90     | 20 +++++++++++++++++
 .../gfortran.dg/goacc-gomp/pr102330-3.f90     | 22 +++++++++++++++++++
 3 files changed, 62 insertions(+)
 create mode 100644 gcc/testsuite/gfortran.dg/goacc-gomp/pr102330-1.f90
 create mode 100644 gcc/testsuite/gfortran.dg/goacc-gomp/pr102330-2.f90
 create mode 100644 gcc/testsuite/gfortran.dg/goacc-gomp/pr102330-3.f90

diff --git a/gcc/testsuite/gfortran.dg/goacc-gomp/pr102330-1.f90 b/gcc/testsuite/gfortran.dg/goacc-gomp/pr102330-1.f90
new file mode 100644
index 00000000000..fba8c718dc2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc-gomp/pr102330-1.f90
@@ -0,0 +1,20 @@
+! { dg-additional-options -fchecking }
+! { dg-ice TODO }
+
+! { dg-additional-options -fopt-info-omp-note }
+
+! { dg-additional-options --param=openacc-privatization=noisy }
+
+program p
+  !$omp master taskloop simd
+  do i = 1, 8
+  end do
+  !$acc parallel loop ! { dg-line l_compute1 }
+  ! { dg-note {variable 'i' in 'private' clause is candidate for adjusting OpenACC privatization level} {} { target *-*-* } l_compute1 }
+  do i = 1, 8
+  end do
+end
+! { dg-bogus {Error: non-register as LHS of binary operation} TODO { target { ! offloading_enabled } xfail *-*-* } .-1 }
+! { dg-bogus {error: non-register as LHS of binary operation} TODO { target offloading_enabled xfail *-*-* } .-2 }
+! TODO See PR101551 for 'offloading_enabled' differences.
+! { dg-excess-errors ICE }
diff --git a/gcc/testsuite/gfortran.dg/goacc-gomp/pr102330-2.f90 b/gcc/testsuite/gfortran.dg/goacc-gomp/pr102330-2.f90
new file mode 100644
index 00000000000..7a1ce8b088c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc-gomp/pr102330-2.f90
@@ -0,0 +1,20 @@
+! { dg-additional-options -fchecking }
+! { dg-ice TODO }
+
+! { dg-additional-options -fopt-info-omp-note }
+
+! { dg-additional-options --param=openacc-privatization=noisy }
+
+program p
+  !$omp taskloop lastprivate(i)
+  do i = 1, 8
+  end do
+  !$acc parallel loop ! { dg-line l_compute1 }
+  ! { dg-note {variable 'i' in 'private' clause is candidate for adjusting OpenACC privatization level} {} { target *-*-* } l_compute1 }
+  do i = 1, 8
+  end do
+end
+! { dg-bogus {Error: non-register as LHS of binary operation} TODO { target { ! offloading_enabled } xfail *-*-* } .-1 }
+! { dg-bogus {error: non-register as LHS of binary operation} TODO { target offloading_enabled xfail *-*-* } .-2 }
+! TODO See PR101551 for 'offloading_enabled' differences.
+! { dg-excess-errors ICE }
diff --git a/gcc/testsuite/gfortran.dg/goacc-gomp/pr102330-3.f90 b/gcc/testsuite/gfortran.dg/goacc-gomp/pr102330-3.f90
new file mode 100644
index 00000000000..b8b1479c7ea
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc-gomp/pr102330-3.f90
@@ -0,0 +1,22 @@
+! { dg-additional-options -fchecking }
+! { dg-ice TODO }
+
+! { dg-additional-options -fopt-info-omp-note }
+
+! { dg-additional-options --param=openacc-privatization=noisy }
+
+program p
+  i = 0
+  !$omp task shared(i)
+  i = 1
+  !$omp end task
+  !$omp taskwait
+  !$acc parallel loop ! { dg-line l_compute1 }
+  ! { dg-note {variable 'i' in 'private' clause is candidate for adjusting OpenACC privatization level} {} { target *-*-* } l_compute1 }
+  do i = 1, 8
+  end do
+end
+! { dg-bogus {Error: non-register as LHS of binary operation} TODO { target { ! offloading_enabled } xfail *-*-* } .-1 }
+! { dg-bogus {error: non-register as LHS of binary operation} TODO { target offloading_enabled xfail *-*-* } .-2 }
+! TODO See PR101551 for 'offloading_enabled' differences.
+! { dg-excess-errors ICE }
-- 
2.34.1

