[flang-commits] [flang] 31ab2c4 - [flang] Ensure USE-associated objects can be in NAMELIST (#82846)

via flang-commits flang-commits at lists.llvm.org
Fri Feb 23 19:15:36 PST 2024


Author: Peter Klausler
Date: 2024-02-23T21:15:32-06:00
New Revision: 31ab2c4f616d686c06e9b573c8f1a4ae7ad2d8c3

URL: https://github.com/llvm/llvm-project/commit/31ab2c4f616d686c06e9b573c8f1a4ae7ad2d8c3
DIFF: https://github.com/llvm/llvm-project/commit/31ab2c4f616d686c06e9b573c8f1a4ae7ad2d8c3.diff

LOG: [flang] Ensure USE-associated objects can be in NAMELIST (#82846)

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

Fixes https://github.com/llvm/llvm-project/issues/82574.

Added: 
    

Modified: 
    flang/lib/Semantics/resolve-names.cpp
    flang/test/Semantics/namelist01.f90

Removed: 
    


################################################################################
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)


        


More information about the flang-commits mailing list