Skip to content
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: 3 additions & 1 deletion flang/lib/Semantics/compute-offsets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ void ComputeOffsetsHelper::DoCommonBlock(Symbol &commonBlock) {
std::size_t minAlignment{0};
UnorderedSymbolSet previous;
for (auto object : details.objects()) {
Symbol &symbol{*object};
// Allow for host association when the common block is
// OpenMP firstprivate.
Symbol &symbol{object->GetUltimate()};
auto errorSite{
commonBlock.name().empty() ? symbol.name() : commonBlock.name()};
if (std::size_t padding{DoSymbol(symbol.GetUltimate())}) {
Expand Down
2 changes: 1 addition & 1 deletion flang/lib/Semantics/symbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Details &details) {
sep = ',';
}
},
[](const HostAssocDetails &) {},
[&os](const HostAssocDetails &x) { os << " => " << x.symbol(); },
[&](const ProcBindingDetails &x) {
os << " => " << x.symbol().name();
DumpOptional(os, "passName", x.passName());
Expand Down
4 changes: 2 additions & 2 deletions flang/test/Semantics/cuf-device-procedures01.cuf
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ subroutine host()
end subroutine

! CHECK-LABEL: Subprogram scope: host
! CHECK: atomicadd, EXTERNAL: HostAssoc{{$}}
! CHECK: syncthreads, EXTERNAL: HostAssoc{{$}}
! CHECK: atomicadd, EXTERNAL: HostAssoc => atomicadd, EXTERNAL (Function, Implicit): ProcEntity REAL(4){{$}}
! CHECK: syncthreads, EXTERNAL: HostAssoc => syncthreads, EXTERNAL (Subroutine): ProcEntity{{$}}
20 changes: 20 additions & 0 deletions flang/test/Semantics/offsets05.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
!RUN: %flang_fc1 -fdebug-dump-symbols -fopenmp %s | FileCheck %s

subroutine sub
common /block/ a
equivalence (b,c), (d,e), (a,f)
!$omp parallel firstprivate(/block/)
!$omp end parallel
end subroutine

!CHECK: a (Implicit, InCommonBlock) size=4 offset=0: ObjectEntity type: REAL(4)
!CHECK: b (Implicit) size=4 offset=0: ObjectEntity type: REAL(4)
!CHECK: c (Implicit) size=4 offset=0: ObjectEntity type: REAL(4)
!CHECK: d (Implicit) size=4 offset=4: ObjectEntity type: REAL(4)
!CHECK: e (Implicit) size=4 offset=4: ObjectEntity type: REAL(4)
!CHECK: f (Implicit) size=4 offset=0: ObjectEntity type: REAL(4)
!CHECK: sub (Subroutine): HostAssoc => sub (Subroutine): Subprogram ()
!CHECK: Equivalence Sets: (b,c) (d,e) (a,f)
!CHECK: block size=4 offset=0: CommonBlockDetails alignment=4: a
!CHECK: OtherConstruct scope:
!CHECK: a (OmpFirstPrivate, OmpExplicit): HostAssoc => a (Implicit, InCommonBlock) size=4 offset=0: ObjectEntity type: REAL(4)
Loading