public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: <gcc-patches@gcc.gnu.org>
Subject: [committed] [PR90868] Document status quo for duplicate OpenACC 'declare' directives for 'extern' variables
Date: Tue, 18 Jun 2019 22:26:00 -0000	[thread overview]
Message-ID: <874l4mh6oi.fsf@euler.schwinge.homeip.net> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 206 bytes --]

Hi!

This doesn't resolve PR90868, but at least in trunk r272445 we now
"Document status quo for duplicate OpenACC 'declare' directives for
'extern' variables", see attached.


Grüße
 Thomas



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-PR90868-Document-status-quo-for-duplicate-Open.trunk.patch --]
[-- Type: text/x-diff, Size: 7082 bytes --]

From 267951437cde77a09e62d9c151002eeed3cf457c Mon Sep 17 00:00:00 2001
From: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue, 18 Jun 2019 22:14:04 +0000
Subject: [PATCH] [PR90868] Document status quo for duplicate OpenACC 'declare'
 directives for 'extern' variables

	gcc/testsuite/
	PR testsuite/90868
	* c-c++-common/goacc/declare-1.c: Update.
	* c-c++-common/goacc/declare-2.c: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@272445 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/testsuite/ChangeLog                      |  4 +
 gcc/testsuite/c-c++-common/goacc/declare-1.c | 85 ++++++++++++++++-
 gcc/testsuite/c-c++-common/goacc/declare-2.c | 99 ++++++++++++++++++++
 3 files changed, 187 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 473fd66d39fd..981055838ab6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,9 @@
 2019-06-18  Thomas Schwinge  <thomas@codesourcery.com>
 
+	PR testsuite/90868
+	* c-c++-common/goacc/declare-1.c: Update.
+	* c-c++-common/goacc/declare-2.c: Likewise.
+
 	PR middle-end/90862
 	* 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-1.c b/gcc/testsuite/c-c++-common/goacc/declare-1.c
index 7c4380f4f041..46ee01b67595 100644
--- a/gcc/testsuite/c-c++-common/goacc/declare-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/declare-1.c
@@ -96,6 +96,84 @@ f (void)
 }
 
 
+/* The same as 'f'.  */
+
+void
+f_2 (void)
+{
+  int va0;
+#pragma acc declare create(va0)
+
+  int va1;
+#pragma acc declare copyin(va1)
+
+  int *va2;
+#pragma acc declare deviceptr(va2)
+
+  int va3;
+#pragma acc declare device_resident(va3)
+
+#ifndef __cplusplus
+  /* TODO PR90868
+
+     C: "error: variable '[...]' used more than once with '#pragma acc declare'".  */
+#else
+  extern int ve0;
+#pragma acc declare create(ve0)
+
+  extern int ve1;
+#pragma acc declare copyin(ve1)
+
+  extern int *ve2;
+#pragma acc declare deviceptr(ve2)
+
+  extern int ve3;
+#pragma acc declare device_resident(ve3)
+
+  extern int ve4;
+#pragma acc declare link(ve4)
+
+  extern int ve5;
+#pragma acc declare present_or_copyin(ve5)
+ 
+  extern int ve6;
+#pragma acc declare present_or_create(ve6)
+#endif
+
+  int va5;
+#pragma acc declare copy(va5)
+
+  int va6;
+#pragma acc declare copyout(va6)
+
+  int va7;
+#pragma acc declare present(va7)
+
+  int va8;
+#pragma acc declare present_or_copy(va8)
+
+  int va9;
+#pragma acc declare present_or_copyin(va9)
+
+  int va10;
+#pragma acc declare present_or_copyout(va10)
+
+  int va11;
+#pragma acc declare present_or_create(va11)
+
+ a:
+  {
+    int va0;
+#pragma acc declare create(va0)
+    if (v1)
+      goto a;
+    else
+      goto b;
+  }
+ b:;
+}
+
+
 /* The same as 'f' but everything contained in an OpenACC 'data' construct.  */
 
 void
@@ -115,7 +193,12 @@ f_data (void)
     int va3;
 # pragma acc declare device_resident(va3)
 
-#if 0 /* TODO */
+#if 0
+    /* TODO PR90868
+
+       C: "error: variable '[...]' used more than once with '#pragma acc declare'".
+       C++: ICE during gimplification.  */
+
     extern int ve0;
 # pragma acc declare create(ve0)
 
diff --git a/gcc/testsuite/c-c++-common/goacc/declare-2.c b/gcc/testsuite/c-c++-common/goacc/declare-2.c
index af43b6bc8162..e2e22be57e9e 100644
--- a/gcc/testsuite/c-c++-common/goacc/declare-2.c
+++ b/gcc/testsuite/c-c++-common/goacc/declare-2.c
@@ -96,3 +96,102 @@ f_data (void)
 # pragma acc declare present (v2) /* { dg-error "invalid use of" } */
   }
 }
+
+
+/* Testing for PR90868 "Duplicate OpenACC 'declare' directives for 'extern'
+   variables".  */
+
+
+void
+f_pr90868 (void)
+{
+  extern int we0;
+#pragma acc declare create(we0)
+
+  extern int we1;
+#pragma acc declare copyin(we1)
+
+  extern int *we2;
+#pragma acc declare deviceptr(we2)
+
+  extern int we3;
+#pragma acc declare device_resident(we3)
+
+  extern int we4;
+#pragma acc declare link(we4)
+
+  extern int we5;
+#pragma acc declare present_or_copyin(we5)
+ 
+  extern int we6;
+#pragma acc declare present_or_create(we6)
+}
+
+
+/* The same as 'f_pr90868'.  */
+
+/* The errors are emitted for C only; for C++, the duplicate OpenACC 'declare'
+   directives for 'extern' variables are accepted.  */
+
+void
+f_pr90868_2 (void)
+{
+  extern int we0;
+#pragma acc declare create(we0) /* { dg-error "variable 'we0' used more than once with '#pragma acc declare'" "" { target c } } */
+
+  extern int we1;
+#pragma acc declare copyin(we1) /* { dg-error "variable 'we1' used more than once with '#pragma acc declare'" "" { target c } } */
+
+  extern int *we2;
+#pragma acc declare deviceptr(we2) /* { dg-error "variable 'we2' used more than once with '#pragma acc declare'" "" { target c } } */
+
+  extern int we3;
+#pragma acc declare device_resident(we3) /* { dg-error "variable 'we3' used more than once with '#pragma acc declare'" "" { target c } } */
+
+  extern int we4;
+#pragma acc declare link(we4) /* { dg-error "variable 'we4' used more than once with '#pragma acc declare'" "" { target c } } */
+
+  extern int we5;
+#pragma acc declare present_or_copyin(we5) /* { dg-error "variable 'we5' used more than once with '#pragma acc declare'" "" { target c } } */
+ 
+  extern int we6;
+#pragma acc declare present_or_create(we6) /* { dg-error "variable 'we6' used more than once with '#pragma acc declare'" "" { target c } } */
+}
+
+
+/* The same as 'f_pr90868' but everything contained in an OpenACC 'data'
+   construct.  */
+
+#ifdef __cplusplus
+/* TODO PR90868
+
+   C++: ICE during gimplification.  */
+#else
+void
+f_pr90868_data (void)
+{
+#pragma acc data
+  {
+    extern int we0;
+# pragma acc declare create(we0) /* { dg-error "variable 'we0' used more than once with '#pragma acc declare'" "" { target c } } */
+
+    extern int we1;
+# pragma acc declare copyin(we1) /* { dg-error "variable 'we1' used more than once with '#pragma acc declare'" "" { target c } } */
+
+    extern int *we2;
+# pragma acc declare deviceptr(we2) /* { dg-error "variable 'we2' used more than once with '#pragma acc declare'" "" { target c } } */
+
+    extern int we3;
+# pragma acc declare device_resident(we3) /* { dg-error "variable 'we3' used more than once with '#pragma acc declare'" "" { target c } } */
+
+    extern int we4;
+# pragma acc declare link(we4) /* { dg-error "variable 'we4' used more than once with '#pragma acc declare'" "" { target c } } */
+
+    extern int we5;
+# pragma acc declare present_or_copyin(we5) /* { dg-error "variable 'we5' used more than once with '#pragma acc declare'" "" { target c } } */
+ 
+    extern int we6;
+# pragma acc declare present_or_create(we6) /* { dg-error "variable 'we6' used more than once with '#pragma acc declare'" "" { target c } } */
+  }
+}
+#endif
-- 
2.20.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 658 bytes --]

             reply	other threads:[~2019-06-18 22:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-18 22:26 Thomas Schwinge [this message]
2023-12-19 11:20 ` Unify OpenACC/C and C++ behavior re duplicate OpenACC 'declare' directives for 'extern' variables [PR90868] (was: [committed] [PR90868] Document status quo for duplicate OpenACC 'declare' directives for 'extern' variables) Thomas Schwinge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874l4mh6oi.fsf@euler.schwinge.homeip.net \
    --to=thomas@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).