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

Pete Steinfeld via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 12:32:49 PDT 2020


PeteSteinfeld added a comment.

In D87151#2266468 <https://reviews.llvm.org/D87151#2266468>, @klausler wrote:

> A structure constructor can contain a "parent component" as a nested structure constructor (`child(parent=parent(a=1),b=2)`) , or it can name the components of the parent component directly (`child(a=1,b=2)`).

I believe that my latest addition to folding12.f90 covers both of these cases.  Lines 141-144 declare a structure constructor that has a nested structure constructor for the parent component:

  type(child_type), parameter :: child_const3 = &
    child_type(parent_type( &
      parent_field2 = 17.7, parent_field3 = .false., parent_field1 = 18), &
        child_field2 = .false., child_field1 = 19.9, child_field3 = 21)

Lines 152-155 contain a structure constructor that names the fields of the parent type without having an explicit structure constructor for the parent component:

  type(child_type), parameter :: child_const4 = &
    child_type(parent_type( &
      parent_field3 = .true., parent_field1 = 22), &
      child_field1 = 23.4, child_field3 = 24)

Is there an aspect of structure constructors that this test doesn't handle?


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