[flang-commits] [PATCH] D123732: [flang] Allow POINTER attribute statement on procedure interfaces

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Wed Apr 13 13:21:02 PDT 2022


klausler created this revision.
klausler added a reviewer: clementval.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
klausler requested review of this revision.

A POINTER attribute statement is allowed to add the POINTER attribute
to a procedure entity that has already been declared, e.g. with an
INTERFACE block.


https://reviews.llvm.org/D123732

Files:
  flang/lib/Semantics/resolve-names.cpp
  flang/test/Semantics/assign02.f90


Index: flang/test/Semantics/assign02.f90
===================================================================
--- flang/test/Semantics/assign02.f90
+++ flang/test/Semantics/assign02.f90
@@ -15,11 +15,11 @@
   subroutine s0
     !ERROR: 'p1' may not have both the POINTER and TARGET attributes
     real, pointer :: p1, p3
+    !ERROR: 'p2' may not have both the POINTER and ALLOCATABLE attributes
     allocatable :: p2
     !ERROR: 'sin' may not have both the POINTER and INTRINSIC attributes
     real, intrinsic, pointer :: sin
     target :: p1
-    !ERROR: 'p2' may not have both the POINTER and ALLOCATABLE attributes
     pointer :: p2
     !ERROR: 'a' may not have the POINTER attribute because it is a coarray
     real, pointer :: a(:)[*]
Index: flang/lib/Semantics/resolve-names.cpp
===================================================================
--- flang/lib/Semantics/resolve-names.cpp
+++ flang/lib/Semantics/resolve-names.cpp
@@ -3626,8 +3626,7 @@
     symbol.ReplaceName(name.source);
     EndArraySpec();
   } else {
-    Symbol &symbol{DeclareUnknownEntity(name, Attrs{Attr::POINTER})};
-    symbol.ReplaceName(name.source);
+    HandleAttributeStmt(Attr::POINTER, std::get<parser::Name>(x.t));
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123732.422635.patch
Type: text/x-patch
Size: 1227 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220413/63a965e6/attachment.bin>


More information about the flang-commits mailing list