Name resolution defers the analysis of all object pointer initializers to the end of a specification part, including the default initializers of derived type data pointer components. This deferment allows object pointer initializers to contain forward references to objects whose declarations appear later. However, this deferment has the unfortunate effect of causing NULL default initialization of such object pointer components when they do not appear in structure constructors that are used as default initializers, and their default initializers are required. So handle object pointer default initializers of components as they appear, as before.
14 lines
380 B
Fortran
14 lines
380 B
Fortran
! RUN: %flang_fc1 -fdebug-unparse %s | FileCheck %s
|
|
program bug
|
|
integer, target :: ita(2) = [1,2], itb(2) = [3,4], itc(2) = [5,6]
|
|
type t1
|
|
integer, pointer :: p1(:) => ita, p2(:) => itb
|
|
end type
|
|
type t2
|
|
!CHECK: TYPE(t1) :: comp = t1(p1=itc,p2=itb)
|
|
type(t1) :: comp = t1(itc)
|
|
end type
|
|
integer, pointer :: p3(:) => itd
|
|
integer, target :: itd(2) = [7,8]
|
|
end
|