[flang-commits] [flang] [flang] Fix CHECK() crash in module file generator (PR #90234)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Fri Apr 26 09:56:14 PDT 2024


https://github.com/klausler created https://github.com/llvm/llvm-project/pull/90234

A sanity CHECK() in mod-file.cpp needs to allow for USE association of a derived type that has the same name as a locally defined generic interface.

Fixes https://github.com/llvm/llvm-project/issues/90192.

>From 16f7f0a4eae2f5004ae45e7408a28b27dfbb1796 Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Fri, 26 Apr 2024 09:52:35 -0700
Subject: [PATCH] [flang] Fix CHECK() crash in module file generator

A sanity CHECK() in mod-file.cpp needs to allow for USE association
of a derived type that has the same name as a locally defined generic
interface.

Fixes https://github.com/llvm/llvm-project/issues/90192.
---
 flang/lib/Semantics/mod-file.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flang/lib/Semantics/mod-file.cpp b/flang/lib/Semantics/mod-file.cpp
index 4a531c3c0f99f6..923107210a94cc 100644
--- a/flang/lib/Semantics/mod-file.cpp
+++ b/flang/lib/Semantics/mod-file.cpp
@@ -202,7 +202,7 @@ static void HarvestInitializerSymbols(
           HarvestInitializerSymbols(set, *dtSym.scope());
         }
       } else {
-        CHECK(dtSym.has<UseErrorDetails>());
+        CHECK(dtSym.has<UseDetails>() || dtSym.has<UseErrorDetails>());
       }
     } else if (IsNamedConstant(*symbol) || scope.IsDerivedType()) {
       if (const auto *object{symbol->detailsIf<ObjectEntityDetails>()}) {



More information about the flang-commits mailing list