public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Julian Brown <julian@codesourcery.com>
Cc: Cesar Philippidis <cesar@codesourcery.com>,
	       "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	       Tom de Vries <tdevries@suse.de>,
	Fortran List <fortran@gcc.gnu.org>
Subject: Re: [patch] various OpenACC reduction enhancements - FE changes
Date: Tue, 18 Dec 2018 13:06:00 -0000	[thread overview]
Message-ID: <20181218130613.GM23305@tucnak> (raw)
In-Reply-To: <20181213141131.0a5b65c1@squid.athome>

On Thu, Dec 13, 2018 at 02:11:31PM +0000, Julian Brown wrote:
> > Any reason for the above (ditto in C), rather than just adding
> > && ort != C_ORT_ACC to the while loop condition for CPP_OPEN_SQUARE?
> > (, . or * after id-expression is like any other unhandled
> > characters...
> 
> I think the reason was that 'decl' ('t' in the C version) is not set to
> error_mark_node if the while loop is skipped, and then the gimplifier
> gets confused. I've tried to tackle this in another way, by checking
> there aren't any stray characters before the next comma or
> close-parenthesis.
> 
> I'm not sure if you were objecting to the error message too -- with the
> current patch, the user will just get e.g.:
> 
> error: expected ')' before '.' token
> 
> if they try to use an unsupported type of construct as a reduction
> target.

> @@ -12004,7 +12005,8 @@ c_parser_omp_variable_list (c_parser *parser,
>  	    case OMP_CLAUSE_REDUCTION:
>  	    case OMP_CLAUSE_IN_REDUCTION:
>  	    case OMP_CLAUSE_TASK_REDUCTION:
> -	      while (c_parser_next_token_is (parser, CPP_OPEN_SQUARE))
> +	      while (ort != C_ORT_ACC
> +		     && c_parser_next_token_is (parser, CPP_OPEN_SQUARE))
>  		{
>  		  tree low_bound = NULL_TREE, length = NULL_TREE;
>  
> @@ -12074,6 +12076,10 @@ c_parser_omp_variable_list (c_parser *parser,
>  			}
>  		    }
>  		}
> +	      if (ort == C_ORT_ACC
> +	          && c_parser_next_token_is_not (parser, CPP_COMMA)
> +		  && c_parser_next_token_is_not (parser, CPP_CLOSE_PAREN))
> +		t = error_mark_node;
>  	      break;
>  	    default:
>  	      break;

I still don't understand this at all, sorry.
So, t is guaranteed to be non-error_mark_node before entering this spot.
If you have reduction (decl[0]) etc. vs. reduction (decl), why do you care whether
it is added to the returned list or not for error recovery?  If it is something
that causes ICE in the gimplifier, then user could have written just
reduction (decl) or reduction (decl, ) and have it added to the list anyway,
so the bug would be that it isn't diagnosed as something incorrect in
c_finish_omp_clauses (or whatever the problem with it is).
If there is any kind of garbage after the decl, it will just return to the
caller at that point and the caller should do the error recovery, the same
for reduction (decl[0]) as well as for reduction (decl, [0]).

	Jakub

  reply	other threads:[~2018-12-18 13:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29 18:20 [patch] various OpenACC reduction enhancements Cesar Philippidis
2018-06-29 18:22 ` [patch] various OpenACC reduction enhancements - ME and nvptx changes Cesar Philippidis
2018-10-05 14:09   ` Tom de Vries
2018-10-30 20:09     ` Cesar Philippidis
2018-12-04 12:29   ` Jakub Jelinek
2018-12-04 15:54     ` Tom de Vries
2018-12-13 15:56       ` Julian Brown
2018-06-29 18:23 ` [patch] various OpenACC reduction enhancements - FE changes Cesar Philippidis
2018-12-04 12:57   ` Jakub Jelinek
2018-12-13 14:12     ` Julian Brown
2018-12-18 13:06       ` Jakub Jelinek [this message]
2018-06-29 18:38 ` [patch] various OpenACC reduction enhancements - test cases Cesar Philippidis
2018-12-04 12:59   ` Jakub Jelinek
2018-12-13 14:14     ` Julian Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181218130613.GM23305@tucnak \
    --to=jakub@redhat.com \
    --cc=cesar@codesourcery.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=julian@codesourcery.com \
    --cc=tdevries@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).