File tree Expand file tree Collapse file tree 2 files changed +25
-5
lines changed Expand file tree Collapse file tree 2 files changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -2369,17 +2369,21 @@ void OmpAttributeVisitor::CreateImplicitSymbols(const Symbol *symbol) {
23692369 dsa = prevDSA;
23702370 } else if (taskGenDir) {
23712371 // TODO 5) dummy arg in orphaned taskgen construct -> firstprivate
2372- // variables with static storage duration are predetermined as shared
2373- if (prevDSA.test (Symbol::Flag::OmpShared) || isStaticStorageDuration) {
2372+ if (prevDSA.test (Symbol::Flag::OmpShared)) {
23742373 // 6) shared in enclosing context -> shared
23752374 dsa = {Symbol::Flag::OmpShared};
23762375 makeSymbol (dsa);
23772376 PRINT_IMPLICIT_RULE (" 6) taskgen: shared" );
2377+ } else if (isStaticStorageDuration) {
2378+ // 7) variables with static storage duration are predetermined as shared
2379+ dsa = {Symbol::Flag::OmpShared};
2380+ makeSymbol (dsa);
2381+ PRINT_IMPLICIT_RULE (" 7) taskgen: shared (static storage duration)" );
23782382 } else {
2379- // 7 ) firstprivate
2383+ // 8 ) firstprivate
23802384 dsa = {Symbol::Flag::OmpFirstPrivate};
23812385 makeSymbol (dsa)->set (Symbol::Flag::OmpImplicit);
2382- PRINT_IMPLICIT_RULE (" 7 ) taskgen: firstprivate" );
2386+ PRINT_IMPLICIT_RULE (" 8 ) taskgen: firstprivate" );
23832387 }
23842388 }
23852389 prevDSA = dsa;
Original file line number Diff line number Diff line change @@ -170,7 +170,7 @@ subroutine implicit_dsa_test8
170170 ! $omp end task
171171end subroutine
172172
173- ! Test static storage duration variables default to shared DSA
173+ ! Test variables defined in modules default to shared DSA
174174! DEF: /implicit_dsa_test9_mod Module
175175module implicit_dsa_test9_mod
176176 ! DEF: /implicit_dsa_test9_mod/tm3a PUBLIC (InDataStmt) ObjectEntity COMPLEX(4)
@@ -189,3 +189,19 @@ subroutine implict_dsa_test9
189189 print * ,tm3a
190190 end subroutine
191191end module
192+
193+ ! Test variables in data statement default to shared DSA
194+ ! DEF: /implicit_dsa_test10 (Subroutine) Subprogram
195+ subroutine implicit_dsa_test10
196+ ! DEF: /implicit_dsa_test10/tm3a (Implicit, InDataStmt) ObjectEntity REAL(4)
197+ data tm3a / (0 , 2 )/
198+ ! $omp task
199+ ! $omp task
200+ ! DEF: /implicit_dsa_test10/OtherConstruct1/OtherConstruct1/tm3a (OmpShared) HostAssoc REAL(4)
201+ tm3a = (1 , 2 )
202+ ! $omp end task
203+ ! $omp end task
204+ ! $omp taskwait
205+ ! REF: /implicit_dsa_test10/tm3a
206+ print * ,tm3a
207+ end subroutine
You can’t perform that action at this time.
0 commit comments