File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -1542,8 +1542,15 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPBlockConstruct &x) {
15421542 }
15431543 if (beginDir.v == llvm::omp::Directive::OMPD_master)
15441544 IssueNonConformanceWarning (beginDir.v , beginDir.source );
1545- ClearDataSharingAttributeObjects ();
1546- ClearPrivateDataSharingAttributeObjects ();
1545+
1546+ // The omp_taskgroup directive doesn't have its own data-sharing clauses.
1547+ // It inherits data-sharing attributes from the surrounding context.
1548+ // Therefore, don't clear the data-sharing attributes if it's an omp taskgroup
1549+ if (beginDir.v != llvm::omp::Directive::OMPD_taskgroup) {
1550+ ClearDataSharingAttributeObjects ();
1551+ ClearPrivateDataSharingAttributeObjects ();
1552+ }
1553+
15471554 ClearAllocateNames ();
15481555 return true ;
15491556}
Original file line number Diff line number Diff line change 1+ ! RUN: %flang_fc1 -fopenmp -fopenmp-version=50 -fsyntax-only %s
2+
3+ ! Verify that a list item with a private data-sharing clause used in the 'allocate' clause of 'taskgroup'
4+ ! causes no semantic errors.
5+
6+ subroutine omp_allocate_taskgroup
7+ integer :: x
8+ ! $omp parallel private(x)
9+ ! $omp taskgroup allocate(x)
10+ ! $omp end taskgroup
11+ ! $omp end parallel
12+ end subroutine
You can’t perform that action at this time.
0 commit comments