From 60c5a287720f07cb84553bdf42a32bc42ac67917 Mon Sep 17 00:00:00 2001 From: Peter Klausler Date: Tue, 31 Dec 2024 13:49:43 -0800 Subject: [PATCH] [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. --- flang/module/__fortran_builtins.f90 | 8 ++++---- flang/test/Semantics/get_team.f90 | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/flang/module/__fortran_builtins.f90 b/flang/module/__fortran_builtins.f90 index ef206dfd94310..503633489b575 100644 --- a/flang/module/__fortran_builtins.f90 +++ b/flang/module/__fortran_builtins.f90 @@ -40,15 +40,15 @@ end type type, public :: __builtin_event_type - integer(kind=int64), private :: __count + integer(kind=int64), private :: __count = -1 end type type, public :: __builtin_notify_type - integer(kind=int64), private :: __count + integer(kind=int64), private :: __count = -1 end type type, public :: __builtin_lock_type - integer(kind=int64), private :: __count + integer(kind=int64), private :: __count = -1 end type type, public :: __builtin_ieee_flag_type @@ -88,7 +88,7 @@ __builtin_ieee_round_type(_FORTRAN_RUNTIME_IEEE_OTHER) type, public :: __builtin_team_type - integer(kind=int64), private :: __id + integer(kind=int64), private :: __id = -1 end type integer, parameter, public :: __builtin_atomic_int_kind = selected_int_kind(18) diff --git a/flang/test/Semantics/get_team.f90 b/flang/test/Semantics/get_team.f90 index 7e4886703d17c..a5b49a83f95f5 100644 --- a/flang/test/Semantics/get_team.f90 +++ b/flang/test/Semantics/get_team.f90 @@ -10,6 +10,8 @@ program get_team_test type(team_type) :: result_team logical wrong_result_type, non_integer + result_team = team_type() + !___ standard-conforming statement with no optional arguments present ___ result_team = get_team()