The compiler can't defer the conversion of legacy DATA-style /initializers/ in component declarations to their init() expressions to the general DATA statement conversion pass, since default component values must be present during structure constructor analysis. So move their conversions into name resolution and handle them at the same times as standard '=' initializers are processed. Avoid any potential problems with type parameters being used as repetition counts or values by disallowing legacy DATA-style initializers in PDTs. Fixes https://github.com/llvm/llvm-project/issues/161989.
8 lines
229 B
Fortran
8 lines
229 B
Fortran
! RUN: %flang_fc1 -fdebug-dump-symbols %s 2>&1 | FileCheck %s
|
|
! Ensure that DATA-like default component initializers work.
|
|
! CHECK: j size=4 offset=0: ObjectEntity type: INTEGER(4) init:123_4
|
|
type t
|
|
integer j/123/
|
|
end type
|
|
end
|