forked from OSchip/llvm-project
[flang] Resolve index in pointer assignment to array element
When the LHS of a pointer assignment is an array element, the index must be resolved. Fixed flang-compiler/f18#684. Original-commit: flang-compiler/f18@c39c7872d4 Reviewed-on: https://github.com/flang-compiler/f18/pull/687
This commit is contained in:
parent
9de2bf6aa8
commit
396a659413
|
@ -4711,7 +4711,14 @@ const parser::Name *DeclarationVisitor::ResolveDataRef(
|
|||
[=](const Indirection<parser::StructureComponent> &y) {
|
||||
return ResolveStructureComponent(y.value());
|
||||
},
|
||||
[=](const auto &y) { return ResolveDataRef(y.value().base); },
|
||||
[&](const common::Indirection<parser::ArrayElement> &y) {
|
||||
Walk(y.value().subscripts);
|
||||
return ResolveDataRef(y.value().base);
|
||||
},
|
||||
[&](const common::Indirection<parser::CoindexedNamedObject> &y) {
|
||||
Walk(y.value().imageSelector);
|
||||
return ResolveDataRef(y.value().base);
|
||||
},
|
||||
},
|
||||
x.u);
|
||||
}
|
||||
|
|
|
@ -45,3 +45,14 @@ program p3
|
|||
a(n:,n:) => b
|
||||
a(1:n,1:n) => b
|
||||
end
|
||||
|
||||
! Test pointer assignment to array element
|
||||
program p4
|
||||
type :: t
|
||||
real, pointer :: a
|
||||
end type
|
||||
type(t) :: x(10)
|
||||
integer :: i
|
||||
real, target :: y
|
||||
x(i)%a => y
|
||||
end program
|
||||
|
|
Loading…
Reference in New Issue