File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1401,6 +1401,26 @@ void OmpStructureChecker::CheckTargetUpdate() {
1401
1401
context_.Say (GetContext ().directiveSource ,
1402
1402
" At least one motion-clause (TO/FROM) must be specified on TARGET UPDATE construct." _err_en_US);
1403
1403
}
1404
+ if (toClause && fromClause) {
1405
+ SymbolSourceMap toSymbols, fromSymbols;
1406
+ GetSymbolsInObjectList (
1407
+ std::get<parser::OmpClause::To>(toClause->u ).v , toSymbols);
1408
+ GetSymbolsInObjectList (
1409
+ std::get<parser::OmpClause::From>(fromClause->u ).v , fromSymbols);
1410
+ for (auto &[symbol, source] : toSymbols) {
1411
+ auto fromSymbol = fromSymbols.find (symbol);
1412
+ if (fromSymbol != fromSymbols.end ()) {
1413
+ context_.Say (source,
1414
+ " A list item ('%s') can only appear in a TO or FROM clause, but not in both." _err_en_US,
1415
+ symbol->name ());
1416
+ context_.Say (source, " '%s' appears in the TO clause." _because_en_US,
1417
+ symbol->name ());
1418
+ context_.Say (fromSymbol->second ,
1419
+ " '%s' appears in the FROM clause." _because_en_US,
1420
+ fromSymbol->first ->name ());
1421
+ }
1422
+ }
1423
+ }
1404
1424
}
1405
1425
1406
1426
void OmpStructureChecker::Enter (
Original file line number Diff line number Diff line change @@ -13,4 +13,9 @@ subroutine foo(x)
13
13
! ERROR: At most one NOWAIT clause can appear on the TARGET UPDATE directive
14
14
! $omp target update to(x) nowait nowait
15
15
16
+ ! ERROR: A list item ('x') can only appear in a TO or FROM clause, but not in both.
17
+ ! BECAUSE: 'x' appears in the TO clause.
18
+ ! BECAUSE: 'x' appears in the FROM clause.
19
+ ! $omp target update to(x) from(x)
20
+
16
21
end subroutine
You can’t perform that action at this time.
0 commit comments