+2017-02-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/79431
+ * gimplify.c (gimplify_adjust_omp_clauses): Ignore
+ "omp declare target link" attribute unless is_global_var.
+ * omp-offload.c (find_link_var_op): Likewise.
+
2017-02-09 Nathan Sidwell <nathan@codesourcery.com>
Chung-Lin Tang <cltang@codesourcery.com>
+2017-02-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/79431
+ * c-parser.c (c_parser_omp_declare_target): Don't invoke
+ symtab_node::get on automatic variables.
+
2016-02-09 Nathan Sidwell <nathan@codesourcery.com>
Chung-Lin Tang <cltang@codesourcery.com>
}
if (!at1)
{
- symtab_node *node = symtab_node::get (t);
DECL_ATTRIBUTES (t) = tree_cons (id, NULL_TREE, DECL_ATTRIBUTES (t));
+ if (TREE_CODE (t) != FUNCTION_DECL && !is_global_var (t))
+ continue;
+
+ symtab_node *node = symtab_node::get (t);
if (node != NULL)
{
node->offloadable = 1;
+2017-02-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/79431
+ * parser.c (cp_parser_oacc_declare): Formatting fix.
+ (cp_parser_omp_declare_target): Don't invoke symtab_node::get on
+ automatic variables.
+
2016-02-09 Nathan Sidwell <nathan@codesourcery.com>
Chung-Lin Tang <cltang@codesourcery.com>
id = get_identifier ("omp declare target");
DECL_ATTRIBUTES (decl)
- = tree_cons (id, NULL_TREE, DECL_ATTRIBUTES (decl));
+ = tree_cons (id, NULL_TREE, DECL_ATTRIBUTES (decl));
if (global_bindings_p ())
{
symtab_node *node = symtab_node::get (decl);
}
if (!at1)
{
- symtab_node *node = symtab_node::get (t);
DECL_ATTRIBUTES (t) = tree_cons (id, NULL_TREE, DECL_ATTRIBUTES (t));
+ if (TREE_CODE (t) != FUNCTION_DECL && !is_global_var (t))
+ continue;
+
+ symtab_node *node = symtab_node::get (t);
if (node != NULL)
{
node->offloadable = 1;
if ((ctx->region_type & ORT_TARGET) != 0
&& !(n->value & GOVD_SEEN)
&& GOMP_MAP_ALWAYS_P (OMP_CLAUSE_MAP_KIND (c)) == 0
- && !lookup_attribute ("omp declare target link",
- DECL_ATTRIBUTES (decl)))
+ && (!is_global_var (decl)
+ || !lookup_attribute ("omp declare target link",
+ DECL_ATTRIBUTES (decl))))
{
remove = true;
/* For struct element mapping, if struct is never referenced
{
tree t = *tp;
- if (VAR_P (t) && DECL_HAS_VALUE_EXPR_P (t)
+ if (VAR_P (t)
+ && DECL_HAS_VALUE_EXPR_P (t)
+ && is_global_var (t)
&& lookup_attribute ("omp declare target link", DECL_ATTRIBUTES (t)))
{
*walk_subtrees = 0;
+2017-02-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/79431
+ * c-c++-common/gomp/pr79431.c: New test.
+
2017-02-09 Nathan Sidwell <nathan@codesourcery.com>
Cesar Philippidis <cesar@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
--- /dev/null
+/* PR c/79431 */
+
+void
+foo (void)
+{
+ int a;
+ #pragma omp declare target (a)
+}