File tree Expand file tree Collapse file tree 2 files changed +42
-7
lines changed Expand file tree Collapse file tree 2 files changed +42
-7
lines changed Original file line number Diff line number Diff line change @@ -875,17 +875,24 @@ void OmpAttributeVisitor::ResolveSeqLoopIndexInParallelOrTaskConstruct(
875
875
}
876
876
}
877
877
878
- // 2.15.1.1 Data-sharing Attribute Rules - Predetermined
878
+ // [OMP-4.5] 2.15.1.1 Data-sharing Attribute Rules - Predetermined
879
879
// - A loop iteration variable for a sequential loop in a parallel
880
880
// or task generating construct is private in the innermost such
881
881
// construct that encloses the loop
882
+ // Loop iteration variables are not well defined for DO WHILE loop.
883
+ // Use of DO CONCURRENT inside OpenMP construct is unspecified behavior
884
+ // till OpenMP-5.0 standard.
885
+ // In above both cases we skip the privatization of iteration variables.
882
886
bool OmpAttributeVisitor::Pre (const parser::DoConstruct &x) {
883
- if (!dirContext_.empty () && GetContext ().withinConstruct ) {
884
- if (const auto &iv{GetLoopIndex (x)}; iv.symbol ) {
885
- if (!iv.symbol ->test (Symbol::Flag::OmpPreDetermined)) {
886
- ResolveSeqLoopIndexInParallelOrTaskConstruct (iv);
887
- } else {
888
- // TODO: conflict checks with explicitly determined DSA
887
+ // TODO:[OpenMP 5.1] DO CONCURRENT indices are private
888
+ if (x.IsDoNormal ()) {
889
+ if (!dirContext_.empty () && GetContext ().withinConstruct ) {
890
+ if (const auto &iv{GetLoopIndex (x)}; iv.symbol ) {
891
+ if (!iv.symbol ->test (Symbol::Flag::OmpPreDetermined)) {
892
+ ResolveSeqLoopIndexInParallelOrTaskConstruct (iv);
893
+ } else {
894
+ // TODO: conflict checks with explicitly determined DSA
895
+ }
889
896
}
890
897
}
891
898
}
Original file line number Diff line number Diff line change
1
+ ! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
2
+
3
+ subroutine bug48308 (x ,i )
4
+ real :: x(:)
5
+ integer :: i
6
+ ! $omp parallel firstprivate(i)
7
+ do while (i> 0 )
8
+ x(i) = i
9
+ i = i - 1
10
+ end do
11
+ ! $omp end parallel
12
+ end subroutine
13
+
14
+ subroutine s1 (x ,i )
15
+ real :: x(:)
16
+ integer :: i
17
+ ! $omp parallel firstprivate(i)
18
+ do i = 10 , 1 , - 1
19
+ x(i) = i
20
+ end do
21
+ ! $omp end parallel
22
+
23
+ ! $omp parallel firstprivate(i)
24
+ do concurrent (i = 1 :10 :1 )
25
+ x(i) = i
26
+ end do
27
+ ! $omp end parallel
28
+ end subroutine
You can’t perform that action at this time.
0 commit comments