See attached patch, v2.  A scalar ASSOCIATE name of a variable is a
pointer to its selector, and gfc_omp_predetermined_sharing makes that
pointer firstprivate.  In a target construct the device then gets the
host address of the selector and faults when it dereferences it.

The fix treats the associate name like a by-reference dummy: privatized
by reference and predetermined shared, which OpenMP 5.2 (5.1.1)
requires anyway for an associate name whose association occurs outside
the construct.  gfc_omp_scalar_p then looks through the pointer, so the
implicit data-mapping rules make the value firstprivate on a target
construct, as for any scalar.

Changes since v1.  The associate names of SELECT TYPE and SELECT RANK
(RANK (0)) still faulted on the device, because they are artificial
decls, which gfc_omp_privatize_by_reference rejected and
gfc_omp_predetermined_mapping mapped 'to' as pointers.  v1 also ICEd in
lower_omp_target for a map of a component through an associate name,
such as map(tofrom: mc%block) or an OpenACC copy clause.  The fixes for
both touch omp-low.cc, so v2 needs a middle-end review as well.

Read the trans-openmp.cc hunks in order: gfc_omp_privatize_by_reference
accepts associate names, also artificial ones,
gfc_omp_predetermined_sharing returns shared for all of them,
gfc_omp_predetermined_mapping no longer maps them 'to', and
gfc_omp_scalar_p looks through the pointer.  The trans-decl.cc hunk
makes SELECT TYPE temporaries DECL_BY_REFERENCE like other associate
names.  In lower_omp_target, the first hunk asks
omp_privatize_by_reference about the variable of an OpenACC
firstprivate clause rather than its copy, which has lost the Fortran
flags, and the second treats a pointer privatized by reference that
does not point to an array as the base of a component map, not as a
reference.  The rest is the new tests.

libgomp.oacc-fortran/associate3.f90 uses firstprivate of an
explicit-shape dummy and so needs the PR129003 patch.

Regression tested on x86_64, and libgomp also with amdgcn offloading.

OK for mainline?

Regards,

Jerry

---

fortran: [PR129002] Treat a scalar associate name as its selector

A scalar ASSOCIATE name of a variable is a pointer to its selector, and
gfc_omp_predetermined_sharing made that pointer firstprivate.  A target
construct therefore copied the host address of the selector to the
device, which faulted when dereferencing it.  Treat the associate name
as a reference to its selector instead: privatized by reference,
predetermined shared, as OpenMP 5.2 (5.1.1) makes an associate name
whose association occurs outside the construct, and scalar for the
implicit data-mapping rules, so that a target construct makes its value
firstprivate.

The associate names of SELECT TYPE and SELECT RANK are artificial decls,
which gfc_omp_privatize_by_reference rejected and
gfc_omp_predetermined_mapping mapped 'to' as pointers.  Treat them like
other associate names, which also makes them DECL_BY_REFERENCE.  In
lower_omp_target, a pointer privatized by reference that does not point
to an array is the base of a component map, not a reference, and the
receiver of an OpenACC firstprivate copy asks about the variable itself,
since its copy has lost the Fortran flags.

Assisted-by: Claude Opus 5.5

        PR fortran/129002

gcc/ChangeLog:

        * omp-low.cc (lower_omp_target): For an OpenACC firstprivate
        variable, ask omp_privatize_by_reference about the variable rather
        than its copy.  Do not treat a pointer privatized by reference that
        does not point to an array as a reference.

gcc/fortran/ChangeLog:

        * trans-decl.cc (gfc_get_symbol_decl): Make SELECT TYPE temporaries
        DECL_BY_REFERENCE too.
        * trans-openmp.cc (gfc_omp_privatize_by_reference): Privatize
        associate names by reference, also artificial ones.
        (gfc_omp_predetermined_sharing): Make associate names shared.
        (gfc_omp_predetermined_mapping): Do not map artificial associate
        names 'to'.
        (gfc_omp_scalar_p): Look through the pointer of an associate name.

gcc/testsuite/ChangeLog:

        * gfortran.dg/gomp/associate3.f90: New test.

libgomp/ChangeLog:

        * testsuite/libgomp.fortran/associate5.f90: New test.
        * testsuite/libgomp.fortran/associate6.f90: New test.
        * testsuite/libgomp.oacc-fortran/associate3.f90: New test.
        * testsuite/libgomp.oacc-fortran/associate4.f90: New test.
>From ece4926f56bf3ea1c8538002753587bb2f01a87c Mon Sep 17 00:00:00 2001
From: Jerry DeLisle <[email protected]>
Date: Tue, 24 Nov 2026 17:41:07 -0800
Subject: [PATCH] fortran: [PR129002] Treat a scalar associate name as its
 selector

A scalar ASSOCIATE name of a variable is a pointer to its selector, and
gfc_omp_predetermined_sharing made that pointer firstprivate.  A target
construct therefore copied the host address of the selector to the
device, which faulted when dereferencing it.  Treat the associate name
as a reference to its selector instead: privatized by reference,
predetermined shared, as OpenMP 5.2 (5.1.1) makes an associate name
whose association occurs outside the construct, and scalar for the
implicit data-mapping rules, so that a target construct makes its value
firstprivate.

The associate names of SELECT TYPE and SELECT RANK are artificial decls,
which gfc_omp_privatize_by_reference rejected and
gfc_omp_predetermined_mapping mapped 'to' as pointers.  Treat them like
other associate names, which also makes them DECL_BY_REFERENCE.  In
lower_omp_target, a pointer privatized by reference that does not point
to an array is the base of a component map, not a reference, and the
receiver of an OpenACC firstprivate copy asks about the variable itself,
since its copy has lost the Fortran flags.

Assisted-by: Claude Opus 5.5

	PR fortran/129002

gcc/ChangeLog:

	* omp-low.cc (lower_omp_target): For an OpenACC firstprivate
	variable, ask omp_privatize_by_reference about the variable rather
	than its copy.  Do not treat a pointer privatized by reference that
	does not point to an array as a reference.

gcc/fortran/ChangeLog:

	* trans-decl.cc (gfc_get_symbol_decl): Make SELECT TYPE temporaries
	DECL_BY_REFERENCE too.
	* trans-openmp.cc (gfc_omp_privatize_by_reference): Privatize
	associate names by reference, also artificial ones.
	(gfc_omp_predetermined_sharing): Make associate names shared.
	(gfc_omp_predetermined_mapping): Do not map artificial associate
	names 'to'.
	(gfc_omp_scalar_p): Look through the pointer of an associate name.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/associate3.f90: New test.

libgomp/ChangeLog:

	* testsuite/libgomp.fortran/associate5.f90: New test.
	* testsuite/libgomp.fortran/associate6.f90: New test.
	* testsuite/libgomp.oacc-fortran/associate3.f90: New test.
	* testsuite/libgomp.oacc-fortran/associate4.f90: New test.
---
 gcc/fortran/trans-decl.cc                     |   3 +-
 gcc/fortran/trans-openmp.cc                   |  23 ++--
 gcc/omp-low.cc                                |   8 +-
 gcc/testsuite/gfortran.dg/gomp/associate3.f90 |  25 ++++
 .../testsuite/libgomp.fortran/associate5.f90  | 123 ++++++++++++++++++
 .../testsuite/libgomp.fortran/associate6.f90  | 117 +++++++++++++++++
 .../libgomp.oacc-fortran/associate3.f90       |  33 +++++
 .../libgomp.oacc-fortran/associate4.f90       |  71 ++++++++++
 8 files changed, 386 insertions(+), 17 deletions(-)
 create mode 100644 gcc/testsuite/gfortran.dg/gomp/associate3.f90
 create mode 100644 libgomp/testsuite/libgomp.fortran/associate5.f90
 create mode 100644 libgomp/testsuite/libgomp.fortran/associate6.f90
 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/associate3.f90
 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/associate4.f90

diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc
index 028ec6e7bef..cf89f9b3f35 100644
--- a/gcc/fortran/trans-decl.cc
+++ b/gcc/fortran/trans-decl.cc
@@ -2180,8 +2180,7 @@ gfc_get_symbol_decl (gfc_symbol * sym)
       && POINTER_TYPE_P (TREE_TYPE (decl))
       && !sym->attr.pointer
       && !sym->attr.allocatable
-      && !sym->attr.proc_pointer
-      && !sym->attr.select_type_temporary)
+      && !sym->attr.proc_pointer)
     DECL_BY_REFERENCE (decl) = 1;
 
   if (sym->attr.associate_var)
diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc
index 72dd185f4e3..00e7e54cfbc 100644
--- a/gcc/fortran/trans-openmp.cc
+++ b/gcc/fortran/trans-openmp.cc
@@ -262,15 +262,15 @@ gfc_omp_privatize_by_reference (const_tree decl)
       /* Array POINTER/ALLOCATABLE have aggregate types, all user variables
 	 that have POINTER_TYPE type and aren't scalar pointers, scalar
 	 allocatables, Cray pointees or C pointers are supposed to be
-	 privatized by reference.  */
+	 privatized by reference.  So are associate names that point to
+	 their selector.  */
       if (GFC_DECL_GET_SCALAR_POINTER (decl)
 	  || GFC_DECL_GET_SCALAR_ALLOCATABLE (decl)
 	  || GFC_DECL_CRAY_POINTEE (decl)
-	  || GFC_DECL_ASSOCIATE_VAR_P (decl)
 	  || VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl))))
 	return false;
 
-      if (!DECL_ARTIFICIAL (decl)
+      if ((!DECL_ARTIFICIAL (decl) || GFC_DECL_ASSOCIATE_VAR_P (decl))
 	  && TREE_CODE (TREE_TYPE (type)) != FUNCTION_TYPE)
 	return true;
 
@@ -290,18 +290,10 @@ gfc_omp_privatize_by_reference (const_tree decl)
 enum omp_clause_default_kind
 gfc_omp_predetermined_sharing (tree decl)
 {
-  /* Associate names preserve the association established during ASSOCIATE.
-     As they are implemented either as pointers to the selector or array
-     descriptor and shouldn't really change in the ASSOCIATE region,
-     this decl can be either shared or firstprivate.  If it is a pointer,
-     use firstprivate, as it is cheaper that way, otherwise make it shared.  */
+  /* An associate name whose association occurs outside the construct is
+     shared (OpenMP 5.2, 5.1.1).  */
   if (GFC_DECL_ASSOCIATE_VAR_P (decl))
-    {
-      if (TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE)
-	return OMP_CLAUSE_DEFAULT_FIRSTPRIVATE;
-      else
-	return OMP_CLAUSE_DEFAULT_SHARED;
-    }
+    return OMP_CLAUSE_DEFAULT_SHARED;
 
   if (DECL_ARTIFICIAL (decl)
       && ! GFC_DECL_RESULT (decl)
@@ -365,6 +357,7 @@ gfc_omp_predetermined_mapping (tree decl)
 {
   if (DECL_ARTIFICIAL (decl)
       && ! GFC_DECL_RESULT (decl)
+      && ! GFC_DECL_ASSOCIATE_VAR_P (decl)
       && ! (DECL_LANG_SPECIFIC (decl)
 	    && GFC_DECL_SAVED_DESCRIPTOR (decl)))
     return OMP_CLAUSE_DEFAULTMAP_TO;
@@ -2807,6 +2800,8 @@ gfc_omp_scalar_p (tree decl, bool ptr_alloc_ok)
 	    return false;
 	  type = TREE_TYPE (type);
 	}
+      else if (GFC_DECL_ASSOCIATE_VAR_P (decl))
+	type = TREE_TYPE (type);
       if (GFC_ARRAY_TYPE_P (type)
 	  || GFC_CLASS_TYPE_P (type))
 	return false;
diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc
index 93a90caaffd..c82161f102f 100644
--- a/gcc/omp-low.cc
+++ b/gcc/omp-low.cc
@@ -13130,7 +13130,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
 	    if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FIRSTPRIVATE)
 	      {
 		gcc_assert (is_gimple_omp_oacc (ctx->stmt));
-		if (omp_privatize_by_reference (new_var)
+		if (omp_privatize_by_reference (var)
 		    && (TREE_CODE (TREE_TYPE (new_var)) != POINTER_TYPE
 		        || DECL_BY_REFERENCE (var)))
 		  {
@@ -14609,6 +14609,12 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
 		  is_ref = omp_privatize_by_reference (var);
 		if (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_FIRSTPRIVATE_REFERENCE)
 		  is_ref = false;
+		/* A pointer privatized by reference, such as a Fortran
+		   associate name, holds the address of the structure.  */
+		if (is_ref
+		    && TREE_CODE (type) == POINTER_TYPE
+		    && TREE_CODE (TREE_TYPE (type)) != ARRAY_TYPE)
+		  is_ref = false;
 		bool ref_to_array = false;
 		bool ref_to_ptr = false;
 		if (is_ref)
diff --git a/gcc/testsuite/gfortran.dg/gomp/associate3.f90 b/gcc/testsuite/gfortran.dg/gomp/associate3.f90
new file mode 100644
index 00000000000..9171d59ba79
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/associate3.f90
@@ -0,0 +1,25 @@
+! { dg-do compile }
+! { dg-additional-options "-fdump-tree-gimple" }
+!
+! PR 129002
+
+subroutine sub (w, n, lr)
+  integer :: n
+  real :: w(n)
+  real :: lr
+  integer :: i
+  associate (eta => lr)
+    !$omp target teams distribute parallel do
+    do i = 1, n
+      w(i) = w(i) - eta
+    end do
+    !$omp parallel do
+    do i = 1, n
+      w(i) = w(i) + eta
+    end do
+  end associate
+end subroutine
+
+! { dg-final { scan-tree-dump-times "#pragma omp target\[^\n\r\]* firstprivate\\(eta\\)" 1 "gimple" } }
+! { dg-final { scan-tree-dump-not "map\\(\[a-z\]*:eta " "gimple" } }
+! { dg-final { scan-tree-dump-times "#pragma omp parallel\[^\n\r\]* shared\\(eta\\)" 2 "gimple" } }
diff --git a/libgomp/testsuite/libgomp.fortran/associate5.f90 b/libgomp/testsuite/libgomp.fortran/associate5.f90
new file mode 100644
index 00000000000..5597a7a560c
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/associate5.f90
@@ -0,0 +1,123 @@
+! { dg-do run }
+!
+! PR 129002
+
+module m
+  implicit none
+  type t
+    integer :: k
+    real(8) :: r
+  end type
+contains
+  subroutine upd (w, n, lr)
+    integer, intent(in) :: n
+    real, intent(inout) :: w(n)
+    real, intent(in), optional :: lr
+    integer :: l
+    associate (eta => lr, m => n)
+      !$omp target teams distribute parallel do
+      do l = 1, m
+        w(l) = w(l) - eta
+      end do
+    end associate
+  end subroutine
+
+  subroutine upd2 (w, lr)
+    real :: w(8)
+    real, intent(in) :: lr
+    integer :: l
+    associate (eta => lr)
+      !$omp target
+      do l = 1, 8
+        w(l) = w(l) * eta
+      end do
+      !$omp end target
+    end associate
+  end subroutine
+end module
+
+program p
+  use m
+  implicit none
+  real :: w(8), x, c(5), v(20), y(10)
+  integer :: i, k
+  type(t) :: d
+  character(len=5) :: str
+  integer :: a(5)
+  complex(8) :: z, zw(8)
+  logical :: flag
+
+  w = 1.0
+  call upd (w, 8, 0.5)
+  if (any (w /= 0.5)) stop 1
+  call upd2 (w, 4.0)
+  if (any (w /= 2.0)) stop 2
+
+  x = 3.0
+  associate (s => x)
+    associate (s2 => s)
+      !$omp target teams distribute parallel do
+      do i = 1, 8
+        w(i) = s + s2
+      end do
+    end associate
+  end associate
+  if (any (w /= 6.0)) stop 3
+
+  c = [1., 2., 3., 4., 5.]
+  d = t(7, 2.5d0)
+  associate (s => c(3), r => d%r, kk => d%k)
+    !$omp target parallel do
+    do i = 1, 8
+      w(i) = s * i + real (r) + kk
+    end do
+  end associate
+  do i = 1, 8
+    if (w(i) /= 3.0 * i + 9.5) stop 4
+  end do
+
+  str = 'abcde'
+  z = (1d0, -2d0)
+  flag = .true.
+  associate (ch => str, zz => z, f => flag)
+    !$omp target teams distribute parallel do
+    do i = 1, 5
+      a(i) = ichar (ch(i:i))
+      if (f) zw(i) = zz * i
+    end do
+  end associate
+  do i = 1, 5
+    if (a(i) /= ichar (str(i:i))) stop 5
+    if (zw(i) /= z * i) stop 6
+  end do
+
+  ! A scalar associate name is firstprivate in a target region.
+  k = 1
+  associate (s => k)
+    !$omp target
+      s = 2
+    !$omp end target
+  end associate
+  if (k /= 1) stop 7
+
+  ! A non-scalar one is mapped tofrom.
+  y = [(real (i), i = 1, 10)]
+  associate (vv => y(2:5))
+    !$omp target teams distribute parallel do
+    do i = 1, 4
+      vv(i) = -vv(i)
+    end do
+  end associate
+  if (any (y(2:5) /= [-2., -3., -4., -5.])) stop 8
+
+  ! Shared on the host when associated outside the construct.
+  v = 0
+  associate (s => v(2))
+    !$omp parallel num_threads(4)
+      !$omp single
+        s = 5
+      !$omp end single
+    !$omp end parallel
+  end associate
+  if (v(2) /= 5) stop 9
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/associate6.f90 b/libgomp/testsuite/libgomp.fortran/associate6.f90
new file mode 100644
index 00000000000..f509af203ad
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/associate6.f90
@@ -0,0 +1,117 @@
+! { dg-do run }
+!
+! PR 129002
+
+module m
+  implicit none
+  type t
+    integer :: k
+  end type
+  type c
+    real, allocatable :: block(:)
+  end type
+contains
+  subroutine sr (a, r)
+    integer :: a(..)
+    integer :: r(4)
+    integer :: i
+    select rank (b => a)
+    rank (0)
+      !$omp target teams distribute parallel do map(from:r)
+      do i = 1, 4
+        r(i) = b + i
+      end do
+    rank (1)
+      !$omp target teams distribute parallel do map(from:r)
+      do i = 1, 4
+        r(i) = b(i) * 2
+      end do
+      !$omp target
+        b(2) = 0
+      !$omp end target
+    end select
+  end subroutine
+
+  subroutine comp (d)
+    type(c) :: d
+    integer :: i
+    associate (mc => d)
+      !$omp target map(tofrom:mc%block)
+      do i = 1, size (mc%block)
+        mc%block(i) = mc%block(i) + 1
+      end do
+      !$omp end target
+    end associate
+  end subroutine
+end module
+
+program p
+  use m
+  implicit none
+  class(*), allocatable :: u, ua(:)
+  class(t), allocatable :: w
+  type(c) :: d
+  integer :: r(4), i, n, v4(4)
+  complex(8) :: zr(4)
+
+  u = (1d0, 2d0)
+  select type (v => u)
+  type is (complex(8))
+    !$omp target teams distribute parallel do map(from:zr)
+    do i = 1, 4
+      zr(i) = v * i
+    end do
+  end select
+  if (any (zr /= [((1d0, 2d0) * i, i = 1, 4)])) stop 1
+
+  u = 5
+  select type (v => u)
+  type is (integer)
+    !$omp target teams distribute parallel do map(from:r)
+    do i = 1, 4
+      r(i) = v + i
+    end do
+  end select
+  if (any (r /= [6, 7, 8, 9])) stop 2
+
+  allocate (w, source=t(3))
+  select type (x => w)
+  type is (t)
+    !$omp target map(from:r)
+      r = x%k
+      x%k = 4
+    !$omp end target
+    if (x%k /= 4) stop 3
+  end select
+  if (any (r /= 3)) stop 4
+
+  ua = [1, 2, 3, 4]
+  select type (va => ua)
+  type is (integer)
+    !$omp target teams distribute parallel do map(from:r)
+    do i = 1, 4
+      r(i) = va(i) + 10
+    end do
+    !$omp target
+      va(3) = -3
+    !$omp end target
+  end select
+  if (any (r /= [11, 12, 13, 14])) stop 5
+  select type (ua)
+  type is (integer)
+    if (any (ua /= [1, 2, -3, 4])) stop 6
+  end select
+
+  n = 10
+  call sr (n, r)
+  if (any (r /= [11, 12, 13, 14])) stop 7
+  v4 = [1, 2, 3, 4]
+  call sr (v4, r)
+  if (any (r /= [2, 4, 6, 8])) stop 8
+  if (any (v4 /= [1, 0, 3, 4])) stop 9
+
+  allocate (d%block(64))
+  d%block = 1.0
+  call comp (d)
+  if (any (d%block /= 2.0)) stop 10
+end program
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/associate3.f90 b/libgomp/testsuite/libgomp.oacc-fortran/associate3.f90
new file mode 100644
index 00000000000..eeeef03844c
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-fortran/associate3.f90
@@ -0,0 +1,33 @@
+! { dg-do run }
+!
+! PR 129002
+
+subroutine sub (a, r, lr)
+  real :: a(16), r(16)
+  real, intent(in) :: lr
+  integer :: i
+  associate (s => lr)
+    !$acc parallel loop firstprivate(a) copyout(r)
+    do i = 1, 16
+      r(i) = a(i) + a(17 - i) - s
+    end do
+  end associate
+end subroutine
+
+program p
+  real :: a(16), r(16), w(64), x
+  integer :: i
+  a = [(real (i), i = 1, 16)]
+  call sub (a, r, 1.0)
+  if (any (r /= 16.0)) stop 1
+
+  x = 0.25
+  w = 1
+  associate (s => x)
+    !$acc parallel loop copy(w)
+    do i = 1, 64
+      w(i) = w(i) - s
+    end do
+  end associate
+  if (any (w /= 0.75)) stop 2
+end program
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/associate4.f90 b/libgomp/testsuite/libgomp.oacc-fortran/associate4.f90
new file mode 100644
index 00000000000..0a070e3ba29
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-fortran/associate4.f90
@@ -0,0 +1,71 @@
+! { dg-do run }
+!
+! PR 129002
+
+module m
+  implicit none
+  type c
+    real, allocatable :: block(:)
+  end type
+contains
+  subroutine sr (a, r)
+    integer :: a(..)
+    integer :: r(4)
+    integer :: i
+    select rank (b => a)
+    rank (0)
+      !$acc parallel loop copyout(r)
+      do i = 1, 4
+        r(i) = b + i
+      end do
+    end select
+  end subroutine
+
+  subroutine comp (d)
+    type(c) :: d
+    integer :: i
+    associate (mc => d)
+      !$acc parallel loop copy(mc%block)
+      do i = 1, size (mc%block)
+        mc%block(i) = mc%block(i) + 1
+      end do
+    end associate
+  end subroutine
+end module
+
+program p
+  use m
+  implicit none
+  class(*), allocatable :: u
+  type(c) :: d
+  integer :: r(4), i, n
+  complex(8) :: z, zr(4)
+
+  u = 5
+  select type (v => u)
+  type is (integer)
+    !$acc parallel loop copyout(r)
+    do i = 1, 4
+      r(i) = v + i
+    end do
+  end select
+  if (any (r /= [6, 7, 8, 9])) stop 1
+
+  n = 10
+  call sr (n, r)
+  if (any (r /= [11, 12, 13, 14])) stop 2
+
+  z = (1d0, -2d0)
+  associate (zz => z)
+    !$acc parallel loop copyout(zr)
+    do i = 1, 4
+      zr(i) = zz * i
+    end do
+  end associate
+  if (any (zr /= [(z * i, i = 1, 4)])) stop 3
+
+  allocate (d%block(64))
+  d%block = 1.0
+  call comp (d)
+  if (any (d%block /= 2.0)) stop 4
+end program
-- 
2.56.1

Reply via email to