Before this change, OmpShared was not always set in shared symbols. Instead, absence of private flags was interpreted as shared DSA. The problem was that symbols with no flags, with only a host association, could also mean "has same DSA as in the enclosing context". Now shared symbols behave the same as private and can be treated the same way. Because of the host association symbols with no flags mentioned above, it was also incorrect to simply test the flags of a given symbol to find out if it was private or shared. The function GetSymbolDSA() was added to fix this. It would be better to avoid the need of these special symbols, but this would require changes to how symbols are collected in lowering. Besides that, some semantic checks need to know if a DSA clause was used or not. To avoid confusing implicit symbols with DSA clauses a new flag was added: OmpExplicit. It is now set for all symbols with explicitly determined data-sharing attributes. With the changes above, AddToContextObjectWithDSA() and the symbol to DSA map could probably be removed and the DSA could be obtained directly from the symbol, but this was not attempted. Some debug messages were also added, with the "omp" DEBUG_TYPE, to make it easier to debug the creation of implicit symbols and to visualize all associations of a given symbol. Fixes #130533 Fixes #140882
23 lines
770 B
Fortran
23 lines
770 B
Fortran
! RUN: %flang_fc1 -fopenmp -fdebug-dump-symbols -o - %s 2>&1 | FileCheck %s
|
|
! Check intrinsic reduction symbols (in this case "max" are marked as INTRINSIC
|
|
|
|
! CHECK: MainProgram scope: omp_reduction
|
|
program omp_reduction
|
|
! CHECK: i size=4 offset=0: ObjectEntity type: INTEGER(4)
|
|
integer i
|
|
! CHECK: k size=4 offset=4: ObjectEntity type: INTEGER(4) init:10_4
|
|
integer :: k = 10
|
|
! CHECK: m size=4 offset=8: ObjectEntity type: INTEGER(4) init:12_4
|
|
integer :: m = 12
|
|
|
|
! CHECK: OtherConstruct scope
|
|
! CHECK: i (OmpPrivate, OmpPreDetermined): HostAssoc
|
|
! CHECK: k (OmpReduction, OmpExplicit): HostAssoc
|
|
! CHECK: max, INTRINSIC: ProcEntity
|
|
!$omp parallel do reduction(max:k)
|
|
do i=1,10
|
|
k = i
|
|
end do
|
|
!$omp end parallel do
|
|
end program omp_reduction
|