* [gomp4] finish_oacc_declare fix
@ 2015-07-31 19:11 James Norris
0 siblings, 0 replies; only message in thread
From: James Norris @ 2015-07-31 19:11 UTC (permalink / raw)
To: gcc-patches; +Cc: Thomas Schwinge
[-- Attachment #1: Type: text/plain, Size: 263 bytes --]
Hi,
The attached patch adds a constraint to prevent finish_oacc_declare
from being passed thru multiple times when dealing with a template and
and instance of a template.
Also cleaned up the interface to finish_oacc_declare.
Committed to gomp-4_0-branch.
Jim
[-- Attachment #2: bugfix.patch --]
[-- Type: text/x-patch, Size: 1201 bytes --]
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index f6cc32d..1d80ef2 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -14229,17 +14229,22 @@ find_oacc_return (tree *tp, int *, void *)
}
static void
-finish_oacc_declare (tree fndecl, tree decls)
+finish_oacc_declare (tree fndecl)
{
- tree t, stmt, list, c, ret_clauses, clauses;
+ tree t, stmt, list, c, ret_clauses, clauses, decls;
location_t loc;
tree_stmt_iterator i;
+ if (DECL_USE_TEMPLATE (fndecl))
+ return;
+
list = cur_stmt_list;
+ decls = lookup_attribute ("oacc declare", DECL_ATTRIBUTES (fndecl));
+
if (lookup_attribute ("oacc function", DECL_ATTRIBUTES (fndecl)))
{
- if (lookup_attribute ("oacc declare", DECL_ATTRIBUTES (fndecl)))
+ if (decls)
{
location_t loc = DECL_SOURCE_LOCATION (fndecl);
error_at (loc, "%<#pragma acc declare%> not allowed in %qE", fndecl);
@@ -14463,8 +14468,7 @@ finish_function (int flags)
gcc_assert (!defer_mark_used_calls);
defer_mark_used_calls = true;
- tree decls = lookup_attribute ("oacc declare", DECL_ATTRIBUTES (fndecl));
- finish_oacc_declare (fndecl, decls);
+ finish_oacc_declare (fndecl);
record_key_method_defined (fndecl);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-07-31 18:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-31 19:11 [gomp4] finish_oacc_declare fix James Norris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).