OpenACC: C/C++ - fix async parsing [PR99137]
gcc/c/ChangeLog: PR c/99137 * c-parser.c (c_parser_oacc_clause_async): Reject comma expressions. gcc/cp/ChangeLog: PR c/99137 * parser.c (cp_parser_oacc_clause_async): Reject comma expressions. gcc/testsuite/ChangeLog: PR c/99137 * c-c++-common/goacc/asyncwait-1.c: Update dg-error; add additional test.
This commit is contained in:
parent
80cf2facbb
commit
6ddedd3efa
@ -14332,7 +14332,7 @@ c_parser_oacc_clause_async (c_parser *parser, tree list)
|
||||
{
|
||||
c_parser_consume_token (parser);
|
||||
|
||||
t = c_parser_expression (parser).value;
|
||||
t = c_parser_expr_no_commas (parser, NULL).value;
|
||||
if (!INTEGRAL_TYPE_P (TREE_TYPE (t)))
|
||||
c_parser_error (parser, "expected integer expression");
|
||||
else if (t == error_mark_node
|
||||
|
||||
@ -38050,7 +38050,7 @@ cp_parser_oacc_clause_async (cp_parser *parser, tree list)
|
||||
matching_parens parens;
|
||||
parens.consume_open (parser);
|
||||
|
||||
t = cp_parser_expression (parser);
|
||||
t = cp_parser_assignment_expression (parser);
|
||||
if (t == error_mark_node
|
||||
|| !parens.require_close (parser))
|
||||
cp_parser_skip_to_closing_parenthesis (parser, /*recovering=*/true,
|
||||
|
||||
@ -9,7 +9,7 @@ f (int N, float *a, float *b)
|
||||
b[ii] = a[ii];
|
||||
}
|
||||
|
||||
#pragma acc parallel copyin (a[0:N]) copy (b[0:N]) async (1,) /* { dg-error "expected (primary-|)expression before" } */
|
||||
#pragma acc parallel copyin (a[0:N]) copy (b[0:N]) async (1,) /* { dg-error "expected '\\)' before ',' token" } */
|
||||
{
|
||||
for (ii = 0; ii < N; ii++)
|
||||
b[ii] = a[ii];
|
||||
@ -21,19 +21,19 @@ f (int N, float *a, float *b)
|
||||
b[ii] = a[ii];
|
||||
}
|
||||
|
||||
#pragma acc parallel copyin (a[0:N]) copy (b[0:N]) async (1,2,) /* { dg-error "expected (primary-|)expression before" } */
|
||||
#pragma acc parallel copyin (a[0:N]) copy (b[0:N]) async (1,2,) /* { dg-error "expected '\\)' before ',' token" } */
|
||||
{
|
||||
for (ii = 0; ii < N; ii++)
|
||||
b[ii] = a[ii];
|
||||
}
|
||||
|
||||
#pragma acc parallel copyin (a[0:N]) copy (b[0:N]) async (1,2 3) /* { dg-error "expected '\\)' before numeric constant" } */
|
||||
#pragma acc parallel copyin (a[0:N]) copy (b[0:N]) async (1,2 3) /* { dg-error "expected '\\)' before ',' token" } */
|
||||
{
|
||||
for (ii = 0; ii < N; ii++)
|
||||
b[ii] = a[ii];
|
||||
}
|
||||
|
||||
#pragma acc parallel copyin (a[0:N]) copy (b[0:N]) async (1,2,,) /* { dg-error "expected (primary-|)expression before" } */
|
||||
#pragma acc parallel copyin (a[0:N]) copy (b[0:N]) async (1,2,,) /* { dg-error "expected '\\)' before ',' token" } */
|
||||
{
|
||||
for (ii = 0; ii < N; ii++)
|
||||
b[ii] = a[ii];
|
||||
@ -193,15 +193,15 @@ f (int N, float *a, float *b)
|
||||
|
||||
#pragma acc wait async (1 2) /* { dg-error "expected '\\)' before numeric constant" } */
|
||||
|
||||
#pragma acc wait async (1,) /* { dg-error "expected (primary-|)expression before" } */
|
||||
#pragma acc wait async (1,) /* { dg-error "expected '\\)' before ',' token" } */
|
||||
|
||||
#pragma acc wait async (,1) /* { dg-error "expected (primary-|)expression before" } */
|
||||
|
||||
#pragma acc wait async (1,2,) /* { dg-error "expected (primary-|)expression before" } */
|
||||
#pragma acc wait async (1,2,) /* { dg-error "expected '\\)' before ',' token" } */
|
||||
|
||||
#pragma acc wait async (1,2 3) /* { dg-error "expected '\\)' before numeric constant" } */
|
||||
#pragma acc wait async (1,2 3) /* { dg-error "expected '\\)' before ',' token" } */
|
||||
|
||||
#pragma acc wait async (1,2,,) /* { dg-error "expected (primary-|)expression before" } */
|
||||
#pragma acc wait async (1,2,,) /* { dg-error "expected '\\)' before ',' token" } */
|
||||
|
||||
#pragma acc wait async (1 /* { dg-error "expected '\\)' before end of line" } */
|
||||
|
||||
@ -215,3 +215,10 @@ f (int N, float *a, float *b)
|
||||
/* { dg-error "expected integer expression before" "" { target c } .-1 } */
|
||||
/* { dg-error "expression must be integral" "" { target c++ } .-2 } */
|
||||
}
|
||||
|
||||
/* PR c/99137 */
|
||||
void f2 ()
|
||||
{
|
||||
#pragma acc parallel async(1,2) /* { dg-error "expected '\\)' before ',' token" } */
|
||||
;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user