diff mbox

OpenACC constructs nesting checks

Message ID 563086CC.8000705@mentor.com
State New
Headers show

Commit Message

Tom de Vries Oct. 28, 2015, 8:26 a.m. UTC
On 22/10/15 11:10, Thomas Schwinge wrote:
> Hi Tom!
>
> On Fri, 16 Oct 2015 11:17:25 +0200, Tom de Vries <Tom_deVries@mentor.com> wrote:
>> this patch checks for occurance of oacc offload regions in oacc routines
>> (which means nested parallelism, which is currently not supported) and
>> gives an appropriate error message.
>
>> --- /dev/null
>> +++ b/gcc/testsuite/c-c++-common/goacc/parallel-in-routine.c
>> @@ -0,0 +1,8 @@
>> +#pragma acc routine
>> +void
>> +foo (void)
>> +{
>> +#pragma acc parallel /* { dg-error "OpenACC region inside of OpenACC routine, nested parallelism not supported yet" } */
>> +  ;
>> +}
>
> Please move such tests into
> gcc/testsuite/c-c++-common/goacc/nesting-fail-1.c and/or
> gcc/testsuite/c-c++-common/goacc-gomp/nesting-fail-1.c, and nesting tests
> that are expected to succeed into
> gcc/testsuite/c-c++-common/goacc/nesting-1.c and/or
> gcc/testsuite/c-c++-common/goacc-gomp/nesting-1.c.  (I have not looked up
> the corresponding Fortran testsuite files.)
>
>
> When fixing that, please also add back (checking for appropriate
> diagnostics) the tests that Nathan apparently didn't know where to put,
> and thus removed, in
> <http://news.gmane.org/find-root.php?message_id=%3C56192805.6090200%40acm.org%3E>
> (gomp-4_0-branch r228678), and
> <http://news.gmane.org/find-root.php?message_id=%3C561AE027.9040601%40acm.org%3E>
> (gomp-4_0-branch r228694).
>
>

Committed attached patches:

      1	Move goacc/parallel-in-routine.c to goacc/nesting-fail-1.c
      2	Test for acc loop in omp parallel
      3	Move dg-error tests from goacc/nesting-1.c to
         goacc/nesting-fail-1.c

Thanks,
- Tom
diff mbox

Patch

Move dg-error tests from goacc/nesting-1.c to goacc/nesting-fail-1.c

2015-10-28  Tom de Vries  <tom@codesourcery.com>

	* c-c++-common/goacc/nesting-1.c (f_acc_data): Move dg-error tests to ...
	* c-c++-common/goacc/nesting-fail-1.c (f_acc_data): ... here.
---
 gcc/testsuite/c-c++-common/goacc/nesting-1.c      |  8 --------
 gcc/testsuite/c-c++-common/goacc/nesting-fail-1.c | 19 +++++++++++++++++++
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/gcc/testsuite/c-c++-common/goacc/nesting-1.c b/gcc/testsuite/c-c++-common/goacc/nesting-1.c
index 3a8f838..cab4f98 100644
--- a/gcc/testsuite/c-c++-common/goacc/nesting-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/nesting-1.c
@@ -58,10 +58,6 @@  f_acc_data (void)
 
 #pragma acc exit data delete(i)
 
-#pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
-    for (i = 0; i < 2; ++i)
-      ;
-
 #pragma acc data
     {
 #pragma acc parallel
@@ -92,10 +88,6 @@  f_acc_data (void)
 #pragma acc enter data copyin(i)
 
 #pragma acc exit data delete(i)
-
-#pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
-      for (i = 0; i < 2; ++i)
-	;
     }
   }
 }
diff --git a/gcc/testsuite/c-c++-common/goacc/nesting-fail-1.c b/gcc/testsuite/c-c++-common/goacc/nesting-fail-1.c
index 855444c..bced28a 100644
--- a/gcc/testsuite/c-c++-common/goacc/nesting-fail-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/nesting-fail-1.c
@@ -45,3 +45,22 @@  f_acc_routine (void)
 #pragma acc parallel /* { dg-error "OpenACC region inside of OpenACC routine, nested parallelism not supported yet" } */
   ;
 }
+
+void
+f_acc_data (void)
+{
+  unsigned int i;
+#pragma acc data
+  {
+#pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
+    for (i = 0; i < 2; ++i)
+      ;
+
+#pragma acc data
+    {
+#pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
+      for (i = 0; i < 2; ++i)
+	;
+    }
+  }
+}
-- 
1.9.1