Skip to content

Commit 60c5a28

Browse files
committed
[flang] Add default component initialization to some built-in types
The standard requires EVENT_TYPE, LOCK_TYPE, NOTIFY_TYPE, and TEAM_TYPE to have full default initialization for their nonallocatable private components.
1 parent a77d119 commit 60c5a28

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

flang/module/__fortran_builtins.f90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@
4040
end type
4141

4242
type, public :: __builtin_event_type
43-
integer(kind=int64), private :: __count
43+
integer(kind=int64), private :: __count = -1
4444
end type
4545

4646
type, public :: __builtin_notify_type
47-
integer(kind=int64), private :: __count
47+
integer(kind=int64), private :: __count = -1
4848
end type
4949

5050
type, public :: __builtin_lock_type
51-
integer(kind=int64), private :: __count
51+
integer(kind=int64), private :: __count = -1
5252
end type
5353

5454
type, public :: __builtin_ieee_flag_type
@@ -88,7 +88,7 @@
8888
__builtin_ieee_round_type(_FORTRAN_RUNTIME_IEEE_OTHER)
8989

9090
type, public :: __builtin_team_type
91-
integer(kind=int64), private :: __id
91+
integer(kind=int64), private :: __id = -1
9292
end type
9393

9494
integer, parameter, public :: __builtin_atomic_int_kind = selected_int_kind(18)

flang/test/Semantics/get_team.f90

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ program get_team_test
1010
type(team_type) :: result_team
1111
logical wrong_result_type, non_integer
1212

13+
result_team = team_type()
14+
1315
!___ standard-conforming statement with no optional arguments present ___
1416
result_team = get_team()
1517

0 commit comments

Comments
 (0)