[flang-commits] [PATCH] D154216: [flang] add nested DEC STRUCTURE in DerivedTypeDetails component names
Jean Perier via Phabricator via flang-commits
flang-commits at lists.llvm.org
Fri Jun 30 11:25:55 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2d46264ca6d8: [flang] add nested DEC STRUCTURE in DerivedTypeDetails component names (authored by jeanPerier).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154216/new/
https://reviews.llvm.org/D154216
Files:
flang/lib/Lower/ConvertExprToHLFIR.cpp
flang/lib/Semantics/resolve-names.cpp
flang/test/Semantics/struct02.f90
Index: flang/test/Semantics/struct02.f90
===================================================================
--- /dev/null
+++ flang/test/Semantics/struct02.f90
@@ -0,0 +1,21 @@
+! Test component name resolution with nested legacy DEC structures.
+!RUN: %flang_fc1 -fdebug-dump-symbols %s | FileCheck %s
+
+ structure /a/
+ integer :: a_first_comp
+ structure /b/ b1, b2(100)
+ integer :: i
+ end structure
+ structure /c/ z
+ integer :: i
+ structure /d/ d1, d2(10)
+ real :: x
+ end structure
+ end structure
+ integer :: a_last_comp
+ end structure
+end
+! CHECK: /a/: DerivedType sequence components: a_first_comp,b1,b2,z,a_last_comp
+! CHECK: /b/: DerivedType sequence components: i
+! CHECK: /c/: DerivedType sequence components: i,d1,d2
+! CHECK: /d/: DerivedType sequence components: x
Index: flang/lib/Semantics/resolve-names.cpp
===================================================================
--- flang/lib/Semantics/resolve-names.cpp
+++ flang/lib/Semantics/resolve-names.cpp
@@ -4354,6 +4354,10 @@
} else if (attrs.test(Attr::PARAMETER)) { // C882, C883
Say(name, "Missing initialization for parameter '%s'"_err_en_US);
}
+ if (auto *scopeSymbol{currScope().symbol()})
+ if (auto *details{scopeSymbol->detailsIf<DerivedTypeDetails>()})
+ if (details->isDECStructure())
+ details->add_component(symbol);
}
void DeclarationVisitor::Post(const parser::PointerDecl &x) {
Index: flang/lib/Lower/ConvertExprToHLFIR.cpp
===================================================================
--- flang/lib/Lower/ConvertExprToHLFIR.cpp
+++ flang/lib/Lower/ConvertExprToHLFIR.cpp
@@ -719,6 +719,7 @@
if (recordType.isDependentType())
TODO(getLoc(), "Designate derived type with length parameters in HLFIR");
mlir::Type fieldType = recordType.getType(partInfo.componentName);
+ assert(fieldType && "component name is not known");
mlir::Type fieldBaseType =
hlfir::getFortranElementOrSequenceType(fieldType);
partInfo.componentShape = genComponentShape(componentSym, fieldBaseType);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154216.536333.patch
Type: text/x-patch
Size: 2113 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230630/8fc7bb80/attachment-0001.bin>
More information about the flang-commits
mailing list