OpenACC wait clause
Cesar Philippidis
cesar@codesourcery.com
Mon Jun 27 23:48:00 GMT 2016
On 06/27/2016 12:23 PM, Jakub Jelinek wrote:
> On Mon, Jun 27, 2016 at 11:36:26AM -0700, Cesar Philippidis wrote:
>> @@ -630,9 +653,10 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, uint64_t mask,
>> {
>> gfc_omp_clauses *c = gfc_get_omp_clauses ();
>> locus old_loc;
>> + bool seen_error = false;
>>
>> *cp = NULL;
>> - while (1)
>> + while (!seen_error)
>> {
>> if ((first || gfc_match_char (',') != MATCH_YES)
>> && (needs_space && gfc_match_space () != MATCH_YES))
>
> Why?
> The main loop is while (1) which has break; as the last statement.
> Instead of setting seen_error, just set
> gfc_current_locus = old_loc;
> if you have already matched successfully something, and then break;
> as you already do.
I made that change.
>> @@ -1275,9 +1309,16 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, uint64_t mask,
>> continue;
>> if ((mask & OMP_CLAUSE_TILE)
>> && !c->tile_list
>> - && match_oacc_expr_list ("tile (", &c->tile_list,
>> - true) == MATCH_YES)
>> - continue;
>> + && gfc_match ("tile") == MATCH_YES)
>> + {
>> + if (match_oacc_expr_list (" (", &c->tile_list, true) != MATCH_YES)
>> + {
>> + seen_error = true;
>> + break;
>> + }
>> + needs_space = true;
>> + continue;
>> + }
>> if ((mask & OMP_CLAUSE_TO)
>> && gfc_match_omp_variable_list ("to (",
>> &c->lists[OMP_LIST_TO], false,
>
> So, tile without ()s is also a valid clause in OpenACC?
> If yes, what do you set in c structure for the existence of the clause?
> If it is not valid, then the above change looks wrong.
No. The tile clause always was a () argument. So I should have used
gfc_match_omp_variable_list ("tile (", &c->tile_list) instead. This
patch fixes that.
>> @@ -1309,10 +1350,13 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, uint64_t mask,
>> && gfc_match ("vector") == MATCH_YES)
>> {
>> c->vector = true;
>> - if (gfc_match (" ( length : %e )", &c->vector_expr) == MATCH_YES
>> - || gfc_match (" ( %e )", &c->vector_expr) == MATCH_YES)
>> - needs_space = false;
>> - else
>> + match m = match_oacc_clause_gwv(c, GOMP_DIM_VECTOR);
>
> Formatting, space before (.
Fixed.
>> @@ -1348,7 +1402,7 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, uint64_t mask,
>> break;
>> }
>>
>> - if (gfc_match_omp_eos () != MATCH_YES)
>> + if (seen_error || gfc_match_omp_eos () != MATCH_YES)
>> {
>> gfc_free_omp_clauses (c);
>> return MATCH_ERROR;
>
> Again, IMHO not needed, if you restore the old_loc into gfc_current_loc,
> then gfc_match_omp_eos () will surely fail.
Fixed.
Is this ok for trunk and gcc6?
Cesar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fortran-parser-errors-20160627a.diff
Type: text/x-patch
Size: 12280 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20160627/fc170b1e/attachment.bin>
More information about the Gcc-patches
mailing list