[flang-commits] [flang] 3e20f9a - [flang] Perform default value initialization on abstract type if needed

Valentin Clement via flang-commits flang-commits at lists.llvm.org
Fri Feb 24 00:22:38 PST 2023


Author: Valentin Clement
Date: 2023-02-24T09:22:30+01:00
New Revision: 3e20f9aa1409170fac07ba160a2d7802a468476d

URL: https://github.com/llvm/llvm-project/commit/3e20f9aa1409170fac07ba160a2d7802a468476d
DIFF: https://github.com/llvm/llvm-project/commit/3e20f9aa1409170fac07ba160a2d7802a468476d.diff

LOG: [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

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 e5fb2d9bb0c99..153b9841e796e 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 ||


        


More information about the flang-commits mailing list