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

I added a test to verify that the associated symbol did not have errors before
doing the anaylsis of a call to a component ref along with a test that
triggers the original problem.

Differential Revision: https://reviews.llvm.org/D90074
This commit is contained in:
Peter Steinfeld 2020-10-23 13:10:41 -07:00
parent b6204b995e
commit b6b589ca84
2 changed files with 28 additions and 0 deletions

View File

@ -1700,6 +1700,9 @@ auto ExpressionAnalyzer::AnalyzeProcedureComponentRef(
const parser::StructureComponent &sc{pcr.v.thing}; const parser::StructureComponent &sc{pcr.v.thing};
if (MaybeExpr base{Analyze(sc.base)}) { if (MaybeExpr base{Analyze(sc.base)}) {
if (const Symbol * sym{sc.component.symbol}) { if (const Symbol * sym{sc.component.symbol}) {
if (context_.HasError(sym)) {
return std::nullopt;
}
if (auto *dtExpr{UnwrapExpr<Expr<SomeDerived>>(*base)}) { if (auto *dtExpr{UnwrapExpr<Expr<SomeDerived>>(*base)}) {
if (sym->has<semantics::GenericDetails>()) { if (sym->has<semantics::GenericDetails>()) {
AdjustActuals adjustment{ AdjustActuals adjustment{

View File

@ -114,3 +114,28 @@ module m
end subroutine s7 end subroutine s7
end module 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