re PR c/79431 (ICE in get, at cgraph.h:397)
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. c/ * c-parser.c (c_parser_omp_declare_target): Don't invoke symtab_node::get on automatic variables. cp/ * parser.c (cp_parser_oacc_declare): Formatting fix. (cp_parser_omp_declare_target): Don't invoke symtab_node::get on automatic variables. testsuite/ * c-c++-common/gomp/pr79431.c: New test. From-SVN: r245302
This commit is contained in:
parent
1bbe0d8f47
commit
56f7147848
9 changed files with 48 additions and 6 deletions
|
@ -1,3 +1,10 @@
|
|||
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>
|
||||
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
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>
|
||||
|
||||
|
|
|
@ -16849,8 +16849,11 @@ c_parser_omp_declare_target (c_parser *parser)
|
|||
}
|
||||
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;
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
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>
|
||||
|
||||
|
|
|
@ -36230,7 +36230,7 @@ cp_parser_oacc_declare (cp_parser *parser, cp_token *pragma_tok)
|
|||
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);
|
||||
|
@ -36770,8 +36770,11 @@ cp_parser_omp_declare_target (cp_parser *parser, cp_token *pragma_tok)
|
|||
}
|
||||
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;
|
||||
|
|
|
@ -8938,8 +8938,9 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, gimple_seq body, tree *list_p,
|
|||
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
|
||||
|
|
|
@ -1819,7 +1819,9 @@ find_link_var_op (tree *tp, int *walk_subtrees, void *)
|
|||
{
|
||||
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;
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
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>
|
||||
|
|
8
gcc/testsuite/c-c++-common/gomp/pr79431.c
Normal file
8
gcc/testsuite/c-c++-common/gomp/pr79431.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
/* PR c/79431 */
|
||||
|
||||
void
|
||||
foo (void)
|
||||
{
|
||||
int a;
|
||||
#pragma omp declare target (a)
|
||||
}
|
Loading…
Add table
Reference in a new issue