diff mbox

[testsuite,committed] Add goacc/uninit-use-device-clause.{c,f95}

Message ID 56F415A1.7040401@mentor.com
State New
Headers show

Commit Message

Tom de Vries March 24, 2016, 4:28 p.m. UTC
Hi,

I've committed attached patch, which adds testcases that test the 
-Wuninitialized warning for the use-device-clause on the openacc 
directive host_data.

I found an issue with compilation of the host_data directive on C/C++, 
which I've filed as PR70388 - '[openacc] host_data use_device triggers 
error mentioning use_device_ptr'.

I've added xfails related to that PR.

Thanks,
- Tom
diff mbox

Patch

Add goacc/uninit-use-device-clause.{c,f95}

2016-03-24  Tom de Vries  <tom@codesourcery.com>

	* c-c++-common/goacc/uninit-use-device-clause.c: New test.
	* gfortran.dg/goacc/uninit-use-device-clause.f95: New test.

---
 .../c-c++-common/goacc/uninit-use-device-clause.c          | 14 ++++++++++++++
 .../gfortran.dg/goacc/uninit-use-device-clause.f95         | 10 ++++++++++
 2 files changed, 24 insertions(+)

diff --git a/gcc/testsuite/c-c++-common/goacc/uninit-use-device-clause.c b/gcc/testsuite/c-c++-common/goacc/uninit-use-device-clause.c
new file mode 100644
index 0000000..c5d327c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/uninit-use-device-clause.c
@@ -0,0 +1,14 @@ 
+/* Test fails due to PR70388.  */
+/* { dg-do compile } */
+/* { dg-excess-errors "PR70388" { xfail *-*-* } } */
+/* { dg-additional-options "-Wuninitialized" } */
+
+void
+foo (void)
+{
+  int i;
+
+#pragma acc host_data use_device(i) /* { dg-warning "is used uninitialized in this function" "" { xfail *-*-* } } */
+  {
+  }
+}
diff --git a/gcc/testsuite/gfortran.dg/goacc/uninit-use-device-clause.f95 b/gcc/testsuite/gfortran.dg/goacc/uninit-use-device-clause.f95
new file mode 100644
index 0000000..873eea7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/uninit-use-device-clause.f95
@@ -0,0 +1,10 @@ 
+! { dg-do compile }
+! { dg-additional-options "-Wuninitialized" }
+
+subroutine test
+  integer :: i
+
+  !$acc host_data use_device(i) ! { dg-warning "is used uninitialized in this function" }
+  !$acc end host_data
+end subroutine test
+