Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[flang] Ensure USE-associated objects can be in NAMELIST #82846

Merged
merged 1 commit into from
Feb 24, 2024

Conversation

klausler
Copy link
Contributor

The name resolution for NAMELIST objects didn't allow for symbols that are not ObjectEntityDetails symbols.

Fixes #82574.

The name resolution for NAMELIST objects didn't allow for
symbols that are not ObjectEntityDetails symbols.

Fixes llvm#82574.
@llvmbot llvmbot added flang Flang issues not falling into any other category flang:semantics labels Feb 23, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 23, 2024

@llvm/pr-subscribers-flang-semantics

Author: Peter Klausler (klausler)

Changes

The name resolution for NAMELIST objects didn't allow for symbols that are not ObjectEntityDetails symbols.

Fixes #82574.


Full diff: https://github.com/llvm/llvm-project/pull/82846.diff

2 Files Affected:

  • (modified) flang/lib/Semantics/resolve-names.cpp (+1-1)
  • (modified) flang/test/Semantics/namelist01.f90 (+1)
diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index 36deab969456d0..0cbe0b492fa44a 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -6061,7 +6061,7 @@ void DeclarationVisitor::FinishNamelists() {
             if (!symbol) {
               symbol = &MakeSymbol(name, ObjectEntityDetails{});
               ApplyImplicitRules(*symbol);
-            } else if (!ConvertToObjectEntity(*symbol)) {
+            } else if (!ConvertToObjectEntity(symbol->GetUltimate())) {
               SayWithDecl(name, *symbol, "'%s' is not a variable"_err_en_US);
               context().SetError(*groupSymbol);
             }
diff --git a/flang/test/Semantics/namelist01.f90 b/flang/test/Semantics/namelist01.f90
index b14bf04ac91f90..b93d4b25550e33 100644
--- a/flang/test/Semantics/namelist01.f90
+++ b/flang/test/Semantics/namelist01.f90
@@ -11,6 +11,7 @@ subroutine C8103a(x)
   integer :: x
   !ERROR: 'dupname' is already declared in this scoping unit
   namelist /dupName/ x, x
+  namelist /nl/ uniquename ! ok
 end subroutine C8103a
 
 subroutine C8103b(y)

Copy link
Contributor

@ye-luo ye-luo left a comment

Choose a reason for hiding this comment

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

Verified.

@ye-luo ye-luo merged commit 31ab2c4 into llvm:main Feb 24, 2024
7 checks passed
@klausler
Copy link
Contributor Author

Did you just merge another person's PR without permission??!?

@ye-luo
Copy link
Contributor

ye-luo commented Feb 26, 2024

Did you just merge another person's PR without permission??!?

I have merge permission.

@klausler
Copy link
Contributor Author

Don't do that with my PRs.

Copy link
Contributor

@psteinfeld psteinfeld left a comment

Choose a reason for hiding this comment

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

All builds and tests correctly and looks good.

@ye-luo
Copy link
Contributor

ye-luo commented Feb 26, 2024

Don't do that with my PRs.

I see what you mean now. Sorry about that.

@klausler klausler deleted the bug82574 branch June 3, 2024 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:semantics flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Flang] cannot list module variable in namelist
4 participants