From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C6EAF38708DF; Mon, 28 Dec 2020 08:46:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C6EAF38708DF From: "mscfd at gmx dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/98454] Apparent wrong initialization in function result Date: Mon, 28 Dec 2020 08:46:52 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 9.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mscfd at gmx dot net X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2020 08:46:52 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98454 martin changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mscfd at gmx dot net --- Comment #9 from martin --- Problems with default initialisation of function result were fixed with PR45489. The relevant testcase added by this PR is initialization_27.f90 wh= ich looks very similar to the reported problem (minus the non-initialised components). After playing around a little bit I think the reason why initialization_27.= f90 does not fail in contrast to the reported case (with only unit=3D-1 as comp= onent so as to get valid fortran) is that it has a pointer component. Change t_te= st to something like type :: t_test integer :: unit =3D -1 integer, pointer :: p =3D> null() end type and unit gets properly initialised. Without the pointer component I get bog= us results.=