[flang-commits] [PATCH] D154380: [flang] Prevent lowering crash by properly updating symbol pointer

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Mon Jul 3 12:11:11 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG39dd4ebd2b63: [flang] Prevent lowering crash by properly updating symbol pointer (authored by klausler).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154380/new/

https://reviews.llvm.org/D154380

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


Index: flang/test/Semantics/symbol28.f90
===================================================================
--- flang/test/Semantics/symbol28.f90
+++ flang/test/Semantics/symbol28.f90
@@ -43,7 +43,7 @@
   end subroutine
  end interface
 contains
- !DEF: /m2/s MODULE SubprogramName
+ !REF:/m2/s
  module procedure s
  end procedure
  !DEF: /m2/s2 MODULE, PUBLIC (Subroutine) Subprogram
Index: flang/lib/Semantics/resolve-names.cpp
===================================================================
--- flang/lib/Semantics/resolve-names.cpp
+++ flang/lib/Semantics/resolve-names.cpp
@@ -4005,6 +4005,7 @@
     // Convert the module procedure's interface into a subprogram.
     SetScope(DEREF(symbol->scope()));
     symbol->get<SubprogramDetails>().set_isInterface(false);
+    name.symbol = symbol;
   } else {
     // Copy the interface into a new subprogram scope.
     EraseSymbol(name);
@@ -4025,7 +4026,8 @@
     Symbol::Flag subpFlag, bool hasModulePrefix,
     const parser::LanguageBindingSpec *bindingSpec,
     const ProgramTree::EntryStmtList *entryStmts) {
-  if (hasModulePrefix && currScope().IsGlobal()) { // C1547
+  if (hasModulePrefix && !currScope().IsModule() &&
+      !currScope().IsSubmodule()) { // C1547
     Say(name,
         "'%s' is a MODULE procedure which must be declared within a "
         "MODULE or SUBMODULE"_err_en_US);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154380.536862.patch
Type: text/x-patch
Size: 1361 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230703/eb6967e9/attachment-0001.bin>


More information about the flang-commits mailing list