Pointer components without default initialization pose some difficult (or impossible) problems when they appear as right-hand side targets in pointer assignment statements; they may contain garbage or stale data that looks enough like a valid descriptor to cause a crash. Solve the problem by avoiding it -- ensure that pointers' descriptors are at least minimally established. Differential Revision: https://reviews.llvm.org/D149979
10 lines
187 B
Fortran
10 lines
187 B
Fortran
! RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s
|
|
type :: hasPointer
|
|
class(*), pointer :: sp
|
|
end type
|
|
type(hasPointer) hp
|
|
!CHECK: hp=haspointer(sp=NULL())
|
|
hp = hasPointer()
|
|
end
|
|
|