[flang-commits] [flang] 3726626 - [flang] Fix crash from USE-associated defined I/O subprograms

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Fri Jan 21 17:49:22 PST 2022


Author: Peter Klausler
Date: 2022-01-21T17:49:09-08:00
New Revision: 3726626a26ec7bfccfd526e02f89c1ac5fe3520a

URL: https://github.com/llvm/llvm-project/commit/3726626a26ec7bfccfd526e02f89c1ac5fe3520a
DIFF: https://github.com/llvm/llvm-project/commit/3726626a26ec7bfccfd526e02f89c1ac5fe3520a.diff

LOG: [flang] Fix crash from USE-associated defined I/O subprograms

User-defined derived type I/O implementation subroutines and
generic interfaces may be USE-associated, but the code that builds
the type description table wasn't allowing for that possibility.
Add a call to GetUltimate() to cope.

Differential Revision: https://reviews.llvm.org/D117902

Added: 
    

Modified: 
    flang/lib/Semantics/runtime-type-info.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/runtime-type-info.cpp b/flang/lib/Semantics/runtime-type-info.cpp
index 4c53df09ee637..250223bfafab1 100644
--- a/flang/lib/Semantics/runtime-type-info.cpp
+++ b/flang/lib/Semantics/runtime-type-info.cpp
@@ -1065,7 +1065,7 @@ void RuntimeTableBuilder::IncorporateDefinedIoGenericInterfaces(
     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<GenericDetails>()};
       CHECK(std::holds_alternative<GenericKind::DefinedIo>(
           genericDetails.kind().u));


        


More information about the flang-commits mailing list