This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR64748


Hi,


Ping!

Thanks,
Jim


On 02/02/2016 08:51 AM, James Norris wrote:
Hi!

On 02/01/2016 02:03 PM, Jakub Jelinek wrote:
On Mon, Feb 01, 2016 at 01:41:50PM -0600, James Norris wrote:
The attached patch resolves c/PR64748. The patch
adds the use of parm's with the deviceptr clause.

 [snip snip]
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -10760,7 +10760,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 (!VAR_P (v))
+      if (!VAR_P (v) && !(TREE_CODE (v) == PARM_DECL))

Please don't write !(x == y) but x != y.

Fixed.


--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -30087,7 +30087,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 (!VAR_P (v))
+      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)
      ;

For C++, all this diagnostics is premature, if processing_template_decl
you really often don't know what the type will be, not sure if you always
know at least if it is a VAR_DECL, PARM_DECL or something else.  I bet you
can easily ICE with the current POINTER_TYPE_P (TREE_TYPE (v)) check as
in templates the type can be NULL, or it could be some lang type and only
later on become POINTER_TYPE, etc.
For C++ the diagnostics need to be done during finish_omp_clauses or so, not
earlier.

The check has been moved to finish_omp_clause (). I put the check at
the tail end of the checking, as I wasn't able to determine if there
was a checking precedence done by the if-else-if sequence.

Thanks for the review!

Jim


===== ChangeLog entries...

         gcc/testsuite/

         PR c/64748
         * c-c++-common/goacc/deviceptr-1.c: Add tests.
         * g++.dg/goacc/deviceptr-1.c: New file.


         gcc/cp/

         PR c/64748
         * parser.c (cp_parser_oacc_data_clause_deviceptr): Remove checking.
         * semantics.c (finish_omp_clauses): Add deviceptr checking.


         gcc/c/

         PR c/64748
         * c-parser.c (c_parser_oacc_data_clause_deviceptr): Allow parms.





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]