[PATCH] D87151: [flang] Fix assert on constant folding of extended types

Pete Steinfeld via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 4 14:46:49 PDT 2020


PeteSteinfeld added inline comments.


================
Comment at: flang/lib/Evaluate/expression.cpp:222
+      auto parentIter{parentDetails->componentNames().begin()};
+      for (const auto &childIter : values_) {
+        if (parentIter == parentDetails->componentNames().end()) {
----------------
klausler wrote:
> This loop seems to assume that the order of the containing structure constructor's values will be in 1-1 correspondence with the components of the parent constructor without gaps or rearrangement, and that the parent's parent component (if any) will appear only as a single leading component without a need to recurse to collect its components.
Thanks for pointing this out.  I already have one test that deals with a parent's parent component, but I'll check to see if it's adequate.  I'll also write some tests with out-of-order named components in the structure constructor and look into gaps.  Then I'll see what changes need to be made.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87151/new/

https://reviews.llvm.org/D87151



More information about the llvm-commits mailing list