Hi, The attached patch is a backport of the fix for PR64748.
Thanks, Jim ==== ChangeLog entries.... Backport from trunk: PR c/64748 gcc/cp/ * parser.c (cp_parser_oacc_data_clause_deviceptr): Remove checking. * semantics.c (finish_omp_clauses): Add deviceptr checking. gcc/testsuite/ * c-c++-common/goacc/deviceptr-1.c: Add tests. * g++.dg/goacc/deviceptr-1.c: New file.
Index: gcc/cp/ChangeLog.gomp =================================================================== --- gcc/cp/ChangeLog.gomp (revision 233463) +++ gcc/cp/ChangeLog.gomp (working copy) @@ -1,3 +1,10 @@ +2016-02-15 James Norris <jnor...@codesourcery.com> + + Backport from trunk: + PR c/64748 + * parser.c (cp_parser_oacc_data_clause_deviceptr): Remove checking. + * semantics.c (finish_omp_clauses): Add deviceptr checking. + 2016-02-03 James Norris <jnor...@codesourcery.com> * semantics.c (finish_id_expression): Remove usage check. Index: gcc/cp/parser.c =================================================================== --- gcc/cp/parser.c (revision 233463) +++ gcc/cp/parser.c (working copy) @@ -30093,20 +30093,6 @@ for (t = vars; t; t = TREE_CHAIN (t)) { tree v = TREE_PURPOSE (t); - - /* FIXME diagnostics: Ideally we should keep individual - locations for all the variables in the var list to make the - following errors more precise. Perhaps - c_parser_omp_var_list_parens should construct a list of - locations to go along with the var list. */ - - if (!VAR_P (v) && TREE_CODE (v) != PARM_DECL) - error_at (loc, "%qD is not a variable", v); - else if (TREE_TYPE (v) == error_mark_node) - ; - else if (!POINTER_TYPE_P (TREE_TYPE (v))) - error_at (loc, "%qD is not a pointer variable", v); - tree u = build_omp_clause (loc, OMP_CLAUSE_MAP); OMP_CLAUSE_SET_MAP_KIND (u, GOMP_MAP_FORCE_DEVICEPTR); OMP_CLAUSE_DECL (u) = v; Index: gcc/cp/semantics.c =================================================================== --- gcc/cp/semantics.c (revision 233463) +++ gcc/cp/semantics.c (working copy) @@ -6729,6 +6729,14 @@ remove = true; } else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP + && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_FORCE_DEVICEPTR + && !type_dependent_expression_p (t) + && !POINTER_TYPE_P (TREE_TYPE (t))) + { + error ("%qD is not a pointer variable", t); + remove = true; + } + else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_FIRSTPRIVATE_POINTER) { if (bitmap_bit_p (&generic_head, DECL_UID (t)) Index: gcc/testsuite/ChangeLog.gomp =================================================================== --- gcc/testsuite/ChangeLog.gomp (revision 233463) +++ gcc/testsuite/ChangeLog.gomp (working copy) @@ -1,3 +1,10 @@ +2016-02-15 James Norris <jnor...@codesourcery.com> + + Backport from trunk: + PR c/64748 + * c-c++-common/goacc/deviceptr-1.c: Add tests. + * g++.dg/goacc/deviceptr-1.c: New file. + 2016-02-03 James Norris <jnor...@codesourcery.com> Backport from trunk: Index: gcc/testsuite/c-c++-common/goacc/deviceptr-1.c =================================================================== --- gcc/testsuite/c-c++-common/goacc/deviceptr-1.c (revision 233463) +++ gcc/testsuite/c-c++-common/goacc/deviceptr-1.c (working copy) @@ -84,3 +84,17 @@ #pragma acc parallel deviceptr(s2_p) s2_p = 0; } + +void +func5 (float *fp) +{ +#pragma acc data deviceptr (fp) + ; +} + +void +func6 (float fp) +{ +#pragma acc data deviceptr (fp) /* { dg-error "is not a pointer variable" } */ + ; +} Index: gcc/testsuite/g++.dg/goacc/deviceptr-1.C =================================================================== --- gcc/testsuite/g++.dg/goacc/deviceptr-1.C (revision 0) +++ gcc/testsuite/g++.dg/goacc/deviceptr-1.C (working copy) @@ -0,0 +1,38 @@ +// { dg-do compile } + +template <typename P> +void +func1 (P p) +{ +#pragma acc data deviceptr (p)// { dg-bogus "is not a pointer" } + ; +} + +void +func2 (int *p) +{ + func1 (p); +} + +template <typename P> +void +func3 (P p) +{ +#pragma acc data deviceptr (p)// { dg-error "is not a pointer" } + ; +} +void +func4 (int p) +{ + func3 (p); +} + +template <int N> +void +func5 (int *p, int q) +{ +#pragma acc data deviceptr (p)// { dg-bogus "is not a pointer" } + ; +#pragma acc data deviceptr (q)// { dg-error "is not a pointer" } + ; +}