File tree Expand file tree Collapse file tree 3 files changed +33
-2
lines changed Expand file tree Collapse file tree 3 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -126,8 +126,13 @@ TYPE_PARSER(construct<AccDefaultClause>(
126126// SELF clause is either a simple optional condition for compute construct
127127// or a synonym of the HOST clause for the update directive 2.14.4 holding
128128// an object list.
129- TYPE_PARSER(construct<AccSelfClause>(Parser<AccObjectList>{}) ||
130- construct<AccSelfClause>(scalarLogicalExpr))
129+ TYPE_PARSER(
130+ construct<AccSelfClause>(Parser<AccObjectList>{}) / lookAhead(" )" _tok) ||
131+ construct<AccSelfClause>(scalarLogicalExpr / lookAhead(" )" _tok)) ||
132+ construct<AccSelfClause>(
133+ recovery (fail<std::optional<ScalarLogicalExpr>>(
134+ " logical expression or object list expected" _err_en_US),
135+ SkipTo<')'>{} >> pure<std::optional<ScalarLogicalExpr>>())))
131136
132137// Modifier for copyin, copyout, cache and create
133138TYPE_PARSER(construct<AccDataModifier>(
Original file line number Diff line number Diff line change 1+ ! RUN: %python %S/../test_errors.py %s %flang -fopenacc
2+ integer function square (x , y )
3+ implicit none
4+ integer , intent (in ) :: x, y
5+ ! $acc parallel self(x * 2 > x) ! ok
6+ ! $acc end parallel
7+ ! ERROR: Must have LOGICAL type, but is INTEGER(4)
8+ ! $acc parallel self(x * 2)
9+ ! $acc end parallel
10+ ! ERROR: SELF clause on the PARALLEL directive only accepts optional scalar logical expression
11+ ! $acc parallel self(x, y)
12+ ! $acc end parallel
13+ square = x * x
14+ end function square
Original file line number Diff line number Diff line change 1+ ! RUN: %python %S/../test_errors.py %s %flang -fopenacc
2+ integer function square (x )
3+ implicit none
4+ integer , intent (in ) :: x
5+ ! ERROR: logical expression or object list expected
6+ ! $acc parallel self(,)
7+ ! $acc end parallel
8+ ! ERROR: logical expression or object list expected
9+ ! $acc parallel self(.true., )
10+ ! $acc end parallel
11+ square = x * x
12+ end function square
You can’t perform that action at this time.
0 commit comments