varpool.c (varpool_node::get_create): Don't set 'offloadable' flag for the external...
authorIlya Verbin <ilya.verbin@intel.com>
Fri, 13 Mar 2015 13:30:26 +0000 (13:30 +0000)
committerIlya Verbin <iverbin@gcc.gnu.org>
Fri, 13 Mar 2015 13:30:26 +0000 (13:30 +0000)
gcc/
* varpool.c (varpool_node::get_create): Don't set 'offloadable' flag for
the external decls.
libgomp/
* testsuite/libgomp.fortran/declare-target-1.f90: New test.
* testsuite/libgomp.fortran/declare-target-2.f90: New file.

From-SVN: r221421

gcc/ChangeLog
gcc/varpool.c
libgomp/ChangeLog
libgomp/testsuite/libgomp.fortran/declare-target-1.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/declare-target-2.f90 [new file with mode: 0644]

index 8a24aecda88fc670038a3b915ab8e3b55280b492..5bcfdb9786d319cf75350d309f2bc657b6e60a9c 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-13  Ilya Verbin  <ilya.verbin@intel.com>
+
+       * varpool.c (varpool_node::get_create): Don't set 'offloadable' flag for
+       the external decls.
+
 2015-03-13  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        PR target/64600
index b5836934d72526edb2fbd15bf3dcded912fb7743..ce6427956d800d9be2577a3f22af20ff5d950cc5 100644 (file)
@@ -173,7 +173,7 @@ varpool_node::get_create (tree decl)
   node = varpool_node::create_empty ();
   node->decl = decl;
 
-  if ((flag_openacc || flag_openmp)
+  if ((flag_openacc || flag_openmp) && !DECL_EXTERNAL (decl)
       && lookup_attribute ("omp declare target", DECL_ATTRIBUTES (decl)))
     {
       node->offloadable = 1;
index 6237db56e4b6e975b094dc992f9587dd84bdd886..d62132105076450c87bcd903a2bd79fdb76bfa94 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-13  Ilya Verbin  <ilya.verbin@intel.com>
+
+       * testsuite/libgomp.fortran/declare-target-1.f90: New test.
+       * testsuite/libgomp.fortran/declare-target-2.f90: New file.
+
 2015-03-13  Sebastian Huber  <sebastian.huber@embedded-brains.de>
 
        * configure.tgt (*-*-rtems*): Use local-exec TLS model.
diff --git a/libgomp/testsuite/libgomp.fortran/declare-target-1.f90 b/libgomp/testsuite/libgomp.fortran/declare-target-1.f90
new file mode 100644 (file)
index 0000000..fd9c26f
--- /dev/null
@@ -0,0 +1,15 @@
+! { dg-do run }
+! { dg-additional-sources declare-target-2.f90 }
+
+module declare_target_1_mod
+  integer :: var_x
+  !$omp declare target(var_x)
+end module declare_target_1_mod
+
+  interface
+    subroutine foo ()
+    end subroutine foo
+  end interface
+
+  call foo ()
+end
diff --git a/libgomp/testsuite/libgomp.fortran/declare-target-2.f90 b/libgomp/testsuite/libgomp.fortran/declare-target-2.f90
new file mode 100644 (file)
index 0000000..f8d3ab2
--- /dev/null
@@ -0,0 +1,18 @@
+! Don't compile this anywhere, it is just auxiliary
+! file compiled together with declare-target-1.f90
+! to verify inter-CU module handling of omp declare target.
+! { dg-do compile { target { lp64 && { ! lp64 } } } }
+
+subroutine foo
+  use declare_target_1_mod
+
+  var_x = 10
+  !$omp target update to(var_x)
+
+  !$omp target
+    var_x = var_x * 2;
+  !$omp end target
+
+  !$omp target update from(var_x)
+  if (var_x /= 20) call abort
+end subroutine foo