@@ -1777,28 +1777,13 @@ void OmpAttributeVisitor::ResolveSeqLoopIndexInParallelOrTaskConstruct(
1777
1777
// Use of DO CONCURRENT inside OpenMP construct is unspecified behavior
1778
1778
// till OpenMP-5.0 standard.
1779
1779
// In above both cases we skip the privatization of iteration variables.
1780
- // [OpenMP 5.1] DO CONCURRENT indices are private
1781
1780
bool OmpAttributeVisitor::Pre (const parser::DoConstruct &x) {
1782
1781
if (!dirContext_.empty () && GetContext ().withinConstruct ) {
1783
1782
llvm::SmallVector<const parser::Name *> ivs;
1784
1783
if (x.IsDoNormal ()) {
1785
1784
const parser::Name *iv{GetLoopIndex (x)};
1786
1785
if (iv && iv->symbol )
1787
1786
ivs.push_back (iv);
1788
- } else if (x.IsDoConcurrent ()) {
1789
- const Fortran::parser::LoopControl *loopControl = &*x.GetLoopControl ();
1790
- const Fortran::parser::LoopControl::Concurrent &concurrent =
1791
- std::get<Fortran::parser::LoopControl::Concurrent>(loopControl->u );
1792
- const Fortran::parser::ConcurrentHeader &concurrentHeader =
1793
- std::get<Fortran::parser::ConcurrentHeader>(concurrent.t );
1794
- const std::list<Fortran::parser::ConcurrentControl> &controls =
1795
- std::get<std::list<Fortran::parser::ConcurrentControl>>(
1796
- concurrentHeader.t );
1797
- for (const auto &control : controls) {
1798
- const parser::Name *iv{&std::get<0 >(control.t )};
1799
- if (iv && iv->symbol )
1800
- ivs.push_back (iv);
1801
- }
1802
1787
}
1803
1788
ordCollapseLevel--;
1804
1789
for (auto iv : ivs) {
@@ -1810,9 +1795,6 @@ bool OmpAttributeVisitor::Pre(const parser::DoConstruct &x) {
1810
1795
if (ordCollapseLevel) {
1811
1796
if (const auto *details{iv->symbol ->detailsIf <HostAssocDetails>()}) {
1812
1797
const Symbol *tpSymbol = &details->symbol ();
1813
- // TODO: DoConcurrent won't capture the following check because a new
1814
- // symbol is declared in ResolveIndexName(), which will not have the
1815
- // OmpThreadprivate flag.
1816
1798
if (tpSymbol->test (Symbol::Flag::OmpThreadprivate)) {
1817
1799
context_.Say (iv->source ,
1818
1800
" Loop iteration variable %s is not allowed in THREADPRIVATE." _err_en_US,
@@ -2119,6 +2101,7 @@ static bool IsPrivatizable(const Symbol *sym) {
2119
2101
*sym) && /* OpenMP 5.2, 5.1.1: Assumed-size arrays are shared*/
2120
2102
!sym->owner ().IsDerivedType () &&
2121
2103
sym->owner ().kind () != Scope::Kind::ImpliedDos &&
2104
+ sym->owner ().kind () != Scope::Kind::Forall &&
2122
2105
!sym->detailsIf <semantics::AssocEntityDetails>() &&
2123
2106
!sym->detailsIf <semantics::NamelistDetails>() &&
2124
2107
(!misc ||
0 commit comments