@@ -10396,7 +10396,8 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, gimple_seq body, tree *list_p,
}
}
else if (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_STRUCT
- && code == OMP_TARGET_EXIT_DATA)
+ && (code == OMP_TARGET_EXIT_DATA
+ || code == OACC_EXIT_DATA))
remove = true;
else if (DECL_SIZE (decl)
&& TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST
new file mode 100644
@@ -0,0 +1,35 @@
+/* Check that extraneous GOMP_MAP_STRUCTs are removed from OpenACC exit data
+ directives. */
+
+/* { dg-additional-options "-fdump-tree-omplower" } */
+
+#include <stdlib.h>
+
+struct str {
+ int a;
+ int *b;
+ int *c;
+ int d;
+};
+
+#define N 1024
+
+int
+main (int argc, char *argv[])
+{
+ struct str s;
+
+ s.b = (int *) malloc (sizeof (int) * N);
+ s.c = (int *) malloc (sizeof (int) * N);
+
+ #pragma acc enter data copyin(s.a, s.b[0:N], s.c[0:N], s.d)
+ /* { dg-final { scan-tree-dump {(?n)#pragma omp target oacc_enter_exit_data map\(struct:s \[len: 4\]\) map\(to:s.a \[len: [0-9]+\]\) map\(alloc:s.b \[len: [0-9]+\]\) map\(alloc:s.c \[len: [0-9]+\]\) map\(to:s.d \[len: [0-9]+\]\) map\(to:\*[_0-9]+ \[len: [0-9]+\]\) map\(attach:s.b \[bias: 0\]\) map\(to:\*[_0-9]+ \[len: [0-9]+\]\) map\(attach:s.c \[bias: 0\]\)} omplower } } */
+
+ #pragma acc exit data copyout(s.a, s.b[0:N], s.c[0:N], s.d)
+ /* { dg-final { scan-tree-dump {(?n)#pragma omp target oacc_enter_exit_data map\(from:s.a \[len: [0-9]+\]\) map\(release:s.b \[len: [0-9]+\]\) map\(release:s.c \[len: [0-9]+\]\) map\(from:s.d \[len: [0-9]+\]\) map\(from:\*[_0-9]+ \[len: [0-9]+\]\) map\(detach:s.b \[bias: 0\]\) map\(from:\*[_0-9]+ \[len: [0-9]+\]\) map\(detach:s.c \[bias: 0\]\)} omplower } } */
+
+ free (s.b);
+ free (s.c);
+
+ return 0;
+}