llvm-project/flang/test/Semantics/ac-impl-do-data-ptr.f90
Peter Klausler 20103eeb3a
[flang] Fix exposed "free" instances of ac-implied-do indices (#178516)
Tweak the implementations of IsConstantExpr, IsInitialDataTarget, and
related utilities so that "free" instances of array constructor implied
DO indices are not treated as constant expressions when the surrounding
context (if any) doesn't contain their bounds. This fixes a current bug
in which a "free" implied DO index in a structure constructor got
wrapped up an a Constant<SomeDerived>, which led to a crash in lowering.
2026-01-31 14:47:29 -08:00

10 lines
344 B
Fortran

!RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s
type child
integer, pointer :: id
end type
integer, parameter :: n = 5
integer, save, target :: t1(n)
type(child) :: t2(n) = [(child(t1(i)), i=1,n)]
!CHECK: TYPE(child) :: t2(5_4) = [child::child(id=t1(1_8)),child(id=t1(2_8)),child(id=t1(3_8)),child(id=t1(4_8)),child(id=t1(5_8))]
end