public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] Partial fix for for-15.C (PR middle-end/86660)
@ 2018-07-26 16:26 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2018-07-26 16:26 UTC (permalink / raw)
  To: gcc-patches

Hi!

As mentioned in the PR and now that the middle-end bug is fixed, this fixes
thinkos in the testcase; the result variable has to be omp declare target,
otherwise the declared target functions called from the target regions can't
access it.

The testcase still fails to assemble due to exceptions, but that is
something to be fixed in the nvptx backend (sure, we could add
-fno-exceptions temporarily though for nvptx offloading only).

2018-07-26  Jakub Jelinek  <jakub@redhat.com>

	PR testsuite/86660
	* testsuite/libgomp.c++/for-15.C (results): Include it in
	omp declare target region.
	(main): Use map (always, tofrom: results) instead of
	map (tofrom: results).

--- libgomp/testsuite/libgomp.c++/for-15.C.jj	2018-07-11 15:09:05.997745784 +0200
+++ libgomp/testsuite/libgomp.c++/for-15.C	2018-07-25 12:30:59.490564748 +0200
@@ -88,11 +88,9 @@ private:
 
 template <typename T> const I<T> &J<T>::begin () { return b; }
 template <typename T> const I<T> &J<T>::end () { return e; }
-#pragma omp end declare target
 
 int results[2000];
 
-#pragma omp declare target
 template <typename T>
 void
 baz (I<T> &i)
@@ -186,37 +184,37 @@ main ()
     a[i] = i;
   #pragma omp target data map (to: a)
   {
-    #pragma omp target teams map (tofrom: results)
+    #pragma omp target teams map (always, tofrom: results)
     {
       J<int> j (&a[75], &a[1945]);
       f1 (j);
     }
     check (i >= 75 && i < 1945 && (i - 75) % 3 == 0);
-    #pragma omp target teams map (tofrom: results)
+    #pragma omp target teams map (always, tofrom: results)
     {
       J<int> j (&a[63], &a[1949]);
       f2 (j);
     }
     check (i >= 63 && i < 1949);
-    #pragma omp target teams map (tofrom: results)
+    #pragma omp target teams map (always, tofrom: results)
     {
       J<int> j (&a[58], &a[1979]);
       f3 <2> (j);
     }
     check (i >= 58 && i < 1979 && (i - 58) % 6 == 0);
-    #pragma omp target teams map (tofrom: results)
+    #pragma omp target teams map (always, tofrom: results)
     {
       J<int> j (&a[59], &a[1981]);
       f4 <9> (j);
     }
     check (i >= 59 && i < 1981 && (i - 59) % 9 == 0);
-    #pragma omp target teams map (tofrom: results)
+    #pragma omp target teams map (always, tofrom: results)
     {
       J<int> j (&a[52], &a[1972]);
       f5 (j);
     }
     check (i >= 52 && i < 1972 && (i - 52) % 4 == 0);
-    #pragma omp target teams map (tofrom: results)
+    #pragma omp target teams map (always, tofrom: results)
     {
       J<int> j (&a[31], &a[1827]);
       f6 (j);

	Jakub

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-07-26 16:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-26 16:26 [committed] Partial fix for for-15.C (PR middle-end/86660) Jakub Jelinek

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).