Skip to content

[flang][semantics][OpenMP] store DSA using ultimate sym #107002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions flang/lib/Semantics/resolve-directives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2514,14 +2514,14 @@ void OmpAttributeVisitor::CheckMultipleAppearances(
target = &details->symbol();
}
}
if (HasDataSharingAttributeObject(*target) &&
if (HasDataSharingAttributeObject(target->GetUltimate()) &&
!WithMultipleAppearancesOmpException(symbol, ompFlag)) {
context_.Say(name.source,
"'%s' appears in more than one data-sharing clause "
"on the same OpenMP directive"_err_en_US,
name.ToString());
} else {
AddDataSharingAttributeObject(*target);
AddDataSharingAttributeObject(target->GetUltimate());
if (privateDataSharingAttributeFlags.test(ompFlag)) {
AddPrivateDataSharingAttributeObjects(*target);
}
Expand Down
19 changes: 19 additions & 0 deletions flang/test/Semantics/OpenMP/clause-order.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
! RUN: %python %S/../test_errors.py %s %flang -fopenmp
! Ensure that checks on more than one data-sharing clause do not depend upon
! the clause order

PROGRAM main
INTEGER:: I, N1, N2

!ERROR: 'n1' appears in more than one data-sharing clause on the same OpenMP directive
!$OMP PARALLEL DO PRIVATE(N1) SHARED(N1)
DO I=1, 4
ENDDO
!$OMP END PARALLEL DO

!ERROR: 'n2' appears in more than one data-sharing clause on the same OpenMP directive
!$OMP PARALLEL DO SHARED(N2) PRIVATE(N2)
DO I=1, 4
ENDDO
!$OMP END PARALLEL DO
END PROGRAM
Loading