diff mbox

[gomp4] Allow parameter declarations with deviceptr

Message ID 55945AB8.40309@codesourcery.com
State New
Headers show

Commit Message

James Norris July 1, 2015, 9:25 p.m. UTC
Hi,

This patch allows parameter declarations to be used as
arguments to deviceptr for C and C++.

Committed to gomp-4_0-branch.

Jim

Comments

Cesar Philippidis July 1, 2015, 11:33 p.m. UTC | #1
On 07/01/2015 02:25 PM, James Norris wrote:

> This patch allows parameter declarations to be used as
> arguments to deviceptr for C and C++.

Does this fix an existing failure? If not, can you please add a new test
case?

Thanks,
Cesar
Thomas Schwinge July 7, 2015, 2:01 p.m. UTC | #2
Hi!

On Wed, 1 Jul 2015 16:33:24 -0700, Cesar Philippidis <cesar@codesourcery.com> wrote:
> On 07/01/2015 02:25 PM, James Norris wrote:
> 
> > This patch allows parameter declarations to be used as
> > arguments to deviceptr for C and C++.

Thanks!  I suppose this does fix <http://gcc.gnu.org/PR64748>?

> Does this fix an existing failure? If not, can you please add a new test
> case?

An earlier submission,
<http://news.gmane.org/find-root.php?message_id=%3C54E23658.6060105%40codesourcery.com%3E>,
did include some testsuite changes -- but I had not seen any update of
this patch after Jakub's and my review comments.


Grüße,
 Thomas
diff mbox

Patch

diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 88e68ae..dc244ce 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -10749,7 +10749,7 @@  c_parser_oacc_data_clause_deviceptr (c_parser *parser, tree list)
 	 c_parser_omp_var_list_parens() should construct a list of
 	 locations to go along with the var list.  */
 
-      if (TREE_CODE (v) != VAR_DECL)
+      if (TREE_CODE (v) != VAR_DECL && TREE_CODE (v) != PARM_DECL)
 	error_at (loc, "%qD is not a variable", v);
       else if (TREE_TYPE (v) == error_mark_node)
 	;
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 41fb35e..c233595 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -28122,7 +28122,7 @@  cp_parser_oacc_data_clause_deviceptr (cp_parser *parser, tree list)
 	 c_parser_omp_var_list_parens should construct a list of
 	 locations to go along with the var list.  */
 
-      if (TREE_CODE (v) != VAR_DECL)
+      if (TREE_CODE (v) != VAR_DECL && TREE_CODE (v) != PARM_DECL)
 	error_at (loc, "%qD is not a variable", v);
       else if (TREE_TYPE (v) == error_mark_node)
 	;