[PATCH] D90074: [flang] An erroneous type bound procedure was causing a call to CHECK()

Pete Steinfeld via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 23 14:05:56 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGb6b589ca8484: [flang] An erroneous type bound procedure was causing a call to CHECK() (authored by PeteSteinfeld).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90074

Files:
  flang/lib/Semantics/expression.cpp
  flang/test/Semantics/bindings01.f90


Index: flang/test/Semantics/bindings01.f90
===================================================================
--- flang/test/Semantics/bindings01.f90
+++ flang/test/Semantics/bindings01.f90
@@ -114,3 +114,28 @@
   end subroutine s7
 end module
 
+module m1
+  implicit none
+  interface g
+    module procedure mp
+  end interface g
+
+  type t
+  contains
+    !ERROR: The binding of 'tbp' ('g') must be either an accessible module procedure or an external procedure with an explicit interface
+    procedure,pass(x) :: tbp => g
+  end type t
+
+contains
+  subroutine mp(x)
+    class(t),intent(in) :: x
+  end subroutine
+end module m1
+
+program test
+  use m1
+  type,extends(t) :: t2
+  end type
+  type(t2) a
+  call a%tbp
+end program
Index: flang/lib/Semantics/expression.cpp
===================================================================
--- flang/lib/Semantics/expression.cpp
+++ flang/lib/Semantics/expression.cpp
@@ -1700,6 +1700,9 @@
   const parser::StructureComponent &sc{pcr.v.thing};
   if (MaybeExpr base{Analyze(sc.base)}) {
     if (const Symbol * sym{sc.component.symbol}) {
+      if (context_.HasError(sym)) {
+        return std::nullopt;
+      }
       if (auto *dtExpr{UnwrapExpr<Expr<SomeDerived>>(*base)}) {
         if (sym->has<semantics::GenericDetails>()) {
           AdjustActuals adjustment{


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90074.300403.patch
Type: text/x-patch
Size: 1335 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201023/1180cbc1/attachment.bin>


More information about the llvm-commits mailing list