Skip to content
Open
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: 4 additions & 0 deletions flang/lib/Semantics/resolve-names.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7195,6 +7195,10 @@ bool DeclarationVisitor::Pre(const parser::NamelistStmt::Group &x) {
groupSymbol = &MakeSymbol(groupName, NamelistDetails{});
groupSymbol->ReplaceName(groupName.source);
}
// insert namelist variables into the symbol table
for (const auto &name : std::get<std::list<parser::Name>>(x.t)) {
ResolveName(name);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am concerned about the comment on line 7202

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, FinishNamelists() runs late in the semantic phase so that NAMELIST i followed by REAL i types i to real instead of integer. I'm not sure of the motivation for this other than the comment about host association (and now the paragraph from Extensions you cited). I did test host association with this change and it works. I'm completely fine with -pendantic. I'm also okay with removing the comment. I tried to briefly describe what the code does and left out the why. This reflects a lot of time spent in resolve-names.cpp wondering what a block of code does. I'm easy so if there are no other comments, I'll make the -pendantic change. Do you want the comment deleted? Thanks again for your suggestions.

// Name resolution of group items is deferred to FinishNamelists()
// so that host association is handled correctly.
GetDeferredDeclarationState(true)->namelistGroups.emplace_back(&x);
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 @@ -39,8 +39,8 @@ subroutine s4b
end

subroutine s5
namelist /nl/x
integer x
namelist /nl/i
Copy link
Contributor

@eugeneepshteyn eugeneepshteyn Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't change the existing test case with x (implicit real, but redefined as integer, with -pedantic warning), but add a new test case with i.

integer i
end

subroutine s6
Expand Down