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) {
2369
2369
dsa = prevDSA;
2370
2370
} else if (taskGenDir) {
2371
2371
// 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)) {
2374
2373
// 6) shared in enclosing context -> shared
2375
2374
dsa = {Symbol::Flag::OmpShared};
2376
2375
makeSymbol (dsa);
2377
2376
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)" );
2378
2382
} else {
2379
- // 7 ) firstprivate
2383
+ // 8 ) firstprivate
2380
2384
dsa = {Symbol::Flag::OmpFirstPrivate};
2381
2385
makeSymbol (dsa)->set (Symbol::Flag::OmpImplicit);
2382
- PRINT_IMPLICIT_RULE (" 7 ) taskgen: firstprivate" );
2386
+ PRINT_IMPLICIT_RULE (" 8 ) taskgen: firstprivate" );
2383
2387
}
2384
2388
}
2385
2389
prevDSA = dsa;
Original file line number Diff line number Diff line change @@ -170,7 +170,7 @@ subroutine implicit_dsa_test8
170
170
! $omp end task
171
171
end subroutine
172
172
173
- ! Test static storage duration variables default to shared DSA
173
+ ! Test variables defined in modules default to shared DSA
174
174
! DEF: /implicit_dsa_test9_mod Module
175
175
module implicit_dsa_test9_mod
176
176
! DEF: /implicit_dsa_test9_mod/tm3a PUBLIC (InDataStmt) ObjectEntity COMPLEX(4)
@@ -189,3 +189,19 @@ subroutine implict_dsa_test9
189
189
print * ,tm3a
190
190
end subroutine
191
191
end 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