diff --git a/flang/lib/Semantics/runtime-type-info.cpp b/flang/lib/Semantics/runtime-type-info.cpp --- a/flang/lib/Semantics/runtime-type-info.cpp +++ b/flang/lib/Semantics/runtime-type-info.cpp @@ -1065,7 +1065,7 @@ GenericKind::DefinedIo definedIo, const Scope *scope) { for (; !scope->IsGlobal(); scope = &scope->parent()) { if (auto asst{scope->find(name)}; asst != scope->end()) { - const Symbol &generic{*asst->second}; + const Symbol &generic{asst->second->GetUltimate()}; const auto &genericDetails{generic.get()}; CHECK(std::holds_alternative( genericDetails.kind().u));