[flang-commits] [flang] [Flang] Fix crash in structure constructor lowering for PDT (PR #183543)

via flang-commits flang-commits at lists.llvm.org
Thu Feb 26 07:08:41 PST 2026


https://github.com/blazie2004 updated https://github.com/llvm/llvm-project/pull/183543

>From 02cadcafed4efd13ed6a78e5d26494b18f424c5b Mon Sep 17 00:00:00 2001
From: Jay Satish Kumar Patel <kumarpat at pe31.hpc.amslabs.hpecorp.net>
Date: Thu, 26 Feb 2026 08:54:37 -0600
Subject: [PATCH] [Flang] Fix crash in structure constructor lowering for PDT

---
 flang/lib/Lower/ConvertConstant.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/flang/lib/Lower/ConvertConstant.cpp b/flang/lib/Lower/ConvertConstant.cpp
index c44b9e8a3796b..2c6ca974eb3fa 100644
--- a/flang/lib/Lower/ConvertConstant.cpp
+++ b/flang/lib/Lower/ConvertConstant.cpp
@@ -532,6 +532,8 @@ static mlir::Value genInlinedStructureCtorLitImpl(
   for (const auto &[sym, expr] : ctor.values()) {
     const Fortran::semantics::DerivedTypeSpec *componentParentType =
         sym->owner().derivedTypeSpec();
+    if (!componentParentType)
+      componentParentType = &ctor.derivedTypeSpec();
     assert(componentParentType && "failed to retrieve component parent type");
     if (!res) {
       mlir::Type parentType = converter.genType(*componentParentType);



More information about the flang-commits mailing list