From 9b65e171edf31cd83fd075f6ed4f3943ebecc505 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 19 Mar 2015 20:12:43 +0100 Subject: c-decl.c (c_decl_attributes): Also add "omp declare target" attribute for DECL_EXTERNAL VAR_DECLs. * c-decl.c (c_decl_attributes): Also add "omp declare target" attribute for DECL_EXTERNAL VAR_DECLs. * decl2.c (cplus_decl_attributes): Also add "omp declare target" attribute for DECL_EXTERNAL VAR_DECLs. * testsuite/libgomp.c/target-10.c: New test. * testsuite/libgomp.c++/target-4.C: New test. From-SVN: r221520 --- gcc/c/c-decl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/c/c-decl.c') diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index c140837..e1741f1 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -4407,7 +4407,8 @@ c_decl_attributes (tree *node, tree attributes, int flags) { /* Add implicit "omp declare target" attribute if requested. */ if (current_omp_declare_target_attribute - && ((TREE_CODE (*node) == VAR_DECL && TREE_STATIC (*node)) + && ((TREE_CODE (*node) == VAR_DECL + && (TREE_STATIC (*node) || DECL_EXTERNAL (*node))) || TREE_CODE (*node) == FUNCTION_DECL)) { if (TREE_CODE (*node) == VAR_DECL -- cgit v1.1