From 3e20f9aa1409170fac07ba160a2d7802a468476d Mon Sep 17 00:00:00 2001 From: Valentin Clement Date: Fri, 24 Feb 2023 09:21:45 +0100 Subject: [PATCH] [flang] Perform default value initialization on abstract type if needed Abstract derived-type components can have default value so perform the default value initialization if necessary. ``` type, abstract :: a integer :: b = 10 end type type, extends(a) :: b integer :: d end type ``` Reviewed By: klausler Differential Revision: https://reviews.llvm.org/D144668 --- flang/lib/Semantics/runtime-type-info.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flang/lib/Semantics/runtime-type-info.cpp b/flang/lib/Semantics/runtime-type-info.cpp index e5fb2d9..153b984 100644 --- a/flang/lib/Semantics/runtime-type-info.cpp +++ b/flang/lib/Semantics/runtime-type-info.cpp @@ -613,8 +613,8 @@ const Symbol *RuntimeTableBuilder::DescribeType(Scope &dtScope) { // instances without any initialized components, analyze the type // and set a flag if there's nothing to do for it at run time. AddValue(dtValues, derivedTypeSchema_, "noinitializationneeded"s, - IntExpr<1>(isAbstractType || - (derivedTypeSpec && !derivedTypeSpec->HasDefaultInitialization()))); + IntExpr<1>( + derivedTypeSpec && !derivedTypeSpec->HasDefaultInitialization())); // Similarly, a flag to short-circuit destruction when not needed. AddValue(dtValues, derivedTypeSchema_, "nodestructionneeded"s, IntExpr<1>(isAbstractType || -- 2.7.4