aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog6
-rw-r--r--gcc/c/c-decl.c22
2 files changed, 25 insertions, 3 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 214e57b..e1da067 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,9 @@
+2021-03-15 Tobias Burnus <tobias@codesourcery.com>
+
+ PR c++/99509
+ * c-decl.c (finish_decl): For 'omp declare target implicit' vars,
+ ensure that the varpool node is marked as offloadable.
+
2021-03-05 Tobias Burnus <tobias@codesourcery.com>
PR c/99137
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index b559ed5..3b2241b 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -58,6 +58,9 @@ along with GCC; see the file COPYING3. If not see
#include "c-family/name-hint.h"
#include "c-family/known-headers.h"
#include "c-family/c-spellcheck.h"
+#include "context.h" /* For 'g'. */
+#include "omp-general.h"
+#include "omp-offload.h" /* For offload_vars. */
#include "tree-pretty-print.h"
@@ -5658,9 +5661,22 @@ finish_decl (tree decl, location_t init_loc, tree init,
DECL_ATTRIBUTES (decl))
&& !lookup_attribute ("omp declare target link",
DECL_ATTRIBUTES (decl)))
- DECL_ATTRIBUTES (decl)
- = tree_cons (get_identifier ("omp declare target"),
- NULL_TREE, DECL_ATTRIBUTES (decl));
+ {
+ DECL_ATTRIBUTES (decl)
+ = tree_cons (get_identifier ("omp declare target"),
+ NULL_TREE, DECL_ATTRIBUTES (decl));
+ symtab_node *node = symtab_node::get (decl);
+ if (node != NULL)
+ {
+ node->offloadable = 1;
+ if (ENABLE_OFFLOADING)
+ {
+ g->have_offload = true;
+ if (is_a <varpool_node *> (node))
+ vec_safe_push (offload_vars, decl);
+ }
+ }
+ }
}
/* This is the last point we can lower alignment so give the target the