[committed,PR90861] Document status quo for OpenACC 'declare' not cleaning up for VLAs

Message ID 871rzqh6j9.fsf@euler.schwinge.homeip.net
State New
Headers show
Series
  • [committed,PR90861] Document status quo for OpenACC 'declare' not cleaning up for VLAs
Related show

Commit Message

Thomas Schwinge June 18, 2019, 10:28 p.m.
Hi!

This doesn't resolve PR90861, but at least in trunk r272446 we now
"Document status quo for OpenACC 'declare' not cleaning up for VLAs", see
attached.


Grüße
 Thomas

Patch

From 3f8b36838cd2aa34d59d867ed22fad054f489884 Mon Sep 17 00:00:00 2001
From: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue, 18 Jun 2019 22:14:14 +0000
Subject: [PATCH] [PR90861] Document status quo for OpenACC 'declare' not
 cleaning up for VLAs

	gcc/testsuite/
	PR testsuite/90861
	* c-c++-common/goacc/declare-pr90861.c: New file.
	libgomp/
	PR testsuite/90861
	* testsuite/libgomp.oacc-c-c++-common/declare-vla.c: Update.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@272446 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/testsuite/ChangeLog                       |  3 ++
 .../c-c++-common/goacc/declare-pr90861.c      | 21 +++++++++
 libgomp/ChangeLog                             |  3 ++
 .../libgomp.oacc-c-c++-common/declare-vla.c   | 47 +++++++++++++++++--
 4 files changed, 71 insertions(+), 3 deletions(-)
 create mode 100644 gcc/testsuite/c-c++-common/goacc/declare-pr90861.c

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 981055838ab6..699a94b3ed40 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@ 
 2019-06-18  Thomas Schwinge  <thomas@codesourcery.com>
 
+	PR testsuite/90861
+	* c-c++-common/goacc/declare-pr90861.c: New file.
+
 	PR testsuite/90868
 	* c-c++-common/goacc/declare-1.c: Update.
 	* c-c++-common/goacc/declare-2.c: Likewise.
diff --git a/gcc/testsuite/c-c++-common/goacc/declare-pr90861.c b/gcc/testsuite/c-c++-common/goacc/declare-pr90861.c
new file mode 100644
index 000000000000..7c905624f7a1
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/declare-pr90861.c
@@ -0,0 +1,21 @@ 
+/* Verify that OpenACC 'declare' cleans up for VLAs.  */
+
+/* { dg-additional-options "-fdump-tree-gimple" } */
+
+void f1 (void)
+{
+#define N_f1 1000
+  int A_f1[N_f1];
+#pragma acc declare copy(A_f1)
+  /* { dg-final { scan-tree-dump-times {#pragma omp target oacc_declare map\(to:A_f1} 1 gimple } }
+     { dg-final { scan-tree-dump-times {#pragma omp target oacc_declare map\(from:A_f1} 1 gimple } } */
+}
+
+void f2 (void)
+{
+  int N_f2 = 1000;
+  int A_f2[N_f2];
+#pragma acc declare copy(A_f2)
+  /* { dg-final { scan-tree-dump-times {#pragma omp target oacc_declare map\(to:\(\*A_f2} 1 gimple } }
+     { dg-final { scan-tree-dump-times {#pragma omp target oacc_declare map\(from:\(\*A_f2} 1 gimple { xfail *-*-* } } } TODO PR90861 */
+}
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 06004aafde98..1a0d363e4ba2 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,5 +1,8 @@ 
 2019-06-18  Thomas Schwinge  <thomas@codesourcery.com>
 
+	PR testsuite/90861
+	* testsuite/libgomp.oacc-c-c++-common/declare-vla.c: Update.
+
 	PR middle-end/90862
 	* testsuite/libgomp.oacc-c-c++-common/declare-1.c: Update.
 
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/declare-vla.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/declare-vla.c
index 3ea148ed40db..0f51badca42e 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/declare-vla.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/declare-vla.c
@@ -1,9 +1,10 @@ 
-/* Verify that acc declare accept VLA variables.  */
+/* Verify OpenACC 'declare' with VLAs.  */
 
 #include <assert.h>
 
-int
-main ()
+
+void
+f (void)
 {
   int N = 1000;
   int i, A[N];
@@ -20,6 +21,46 @@  main ()
 
   for (i = 0; i < N; i++)
     assert (A[i] == i);
+}
+
+
+/* The same as 'f' but everything contained in an OpenACC 'data' construct.  */
+
+void
+f_data (void)
+{
+#pragma acc data
+  {
+    int N = 1000;
+    int i, A[N];
+# pragma acc declare copy(A)
+
+    for (i = 0; i < N; i++)
+      A[i] = -i;
+
+# pragma acc kernels
+    for (i = 0; i < N; i++)
+      A[i] = i;
+
+# pragma acc update host(A)
+
+    for (i = 0; i < N; i++)
+      assert (A[i] == i);
+  }
+}
+
+
+int
+main ()
+{
+  f ();
+
+  f_data ();
 
   return 0;
 }
+
+
+/* { dg-xfail-run-if "TODO PR90861" { *-*-* } { "-DACC_MEM_SHARED=0" } }
+   This might XPASS if the compiler happens to put the two 'A' VLAs at the same
+   address.  */
-- 
2.20.1