diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp --- a/flang/lib/Semantics/resolve-directives.cpp +++ b/flang/lib/Semantics/resolve-directives.cpp @@ -79,7 +79,8 @@ GetContext().associatedLoopLevel = level; } Symbol &MakeAssocSymbol(const SourceName &name, Symbol &prev, Scope &scope) { - const auto pair{scope.try_emplace(name, Attrs{}, HostAssocDetails{prev})}; + const auto pair{ + scope.try_emplace(name, prev.attrs(), HostAssocDetails{prev})}; return *pair.first->second; } Symbol &MakeAssocSymbol(const SourceName &name, Symbol &prev) { diff --git a/flang/test/Semantics/omp-symbol09.f90 b/flang/test/Semantics/omp-symbol09.f90 new file mode 100644 --- /dev/null +++ b/flang/test/Semantics/omp-symbol09.f90 @@ -0,0 +1,16 @@ +! RUN: %python %S/test_symbols.py %s %flang_fc1 -fopenmp + +!DEF:/test_attrs (Subroutine) Subprogram +subroutine test_attrs + implicit none + !DEF: /test_attrs/p POINTER ObjectEntity INTEGER(4) + integer, pointer :: p + !DEF: /test_attrs/a ALLOCATABLE ObjectEntity INTEGER(4) + integer, allocatable :: a + + !$omp parallel private(p, a) + !DEF: /test_attrs/Block1/p POINTER (OmpPrivate) HostAssoc INTEGER(4) + !DEF: /test_attrs/Block1/a ALLOCATABLE (OmpPrivate) HostAssoc INTEGER(4) + print *, p, a + !$omp end parallel +end subroutine