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
13 changes: 4 additions & 9 deletions flang/lib/Semantics/resolve-names.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7477,15 +7477,10 @@ bool ConstructVisitor::Pre(const parser::DataImpliedDo &x) {
Walk(bounds.upper);
Walk(bounds.step);
EndCheckOnIndexUseInOwnBounds(restore);
bool pushScope{currScope().kind() != Scope::Kind::ImpliedDos};
if (pushScope) {
PushScope(Scope::Kind::ImpliedDos, nullptr);
}
PushScope(Scope::Kind::ImpliedDos, nullptr);
DeclareStatementEntity(bounds.name, type);
Walk(objects);
if (pushScope) {
PopScope();
}
PopScope();
return false;
}

Expand Down Expand Up @@ -7526,9 +7521,9 @@ bool ConstructVisitor::Pre(const parser::DataStmtObject &x) {
}
},
[&](const parser::DataImpliedDo &y) {
PushScope(Scope::Kind::ImpliedDos, nullptr);
// Don't push scope here, since it's done when visiting
// DataImpliedDo.
Walk(y);
PopScope();
},
},
x.u);
Expand Down
4 changes: 2 additions & 2 deletions flang/test/Semantics/resolve40.f90
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ subroutine s8

subroutine s9
real :: x(2,2)
!ERROR: 'i' is already declared in this scoping unit
data ((x(i,i),i=1,2),i=1,2)/4*0.0/
! Nested implied DO loops have their own scope
data ((x(i,j),j=1,2),(x(i,j),j=1,2),i=1,2)/8*0.0/
end

module m10
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Semantics/symbol09.f90
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ subroutine s3
real, dimension(n,n) :: x
!REF: /s3/x
!DEF: /s3/ImpliedDos1/k (Implicit) ObjectEntity INTEGER(4)
!DEF: /s3/ImpliedDos1/j ObjectEntity INTEGER(8)
!DEF: /s3/ImpliedDos1/ImpliedDos1/j ObjectEntity INTEGER(8)
!REF: /s3/n
!REF: /s3/n2
data ((x(k,j),integer(kind=8)::j=1,n),k=1,n)/n2*3.0/
Expand Down