From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3CB0C3858425; Thu, 13 Apr 2023 15:05:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3CB0C3858425 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681398339; bh=5u9U6gztBAstBffu79BCCPtwJOZFEGlpsZM/X9B+in0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=HTrYPP0aCHZ7UgP3FwWIwPL7wGTchld7cIApS3Ux8ygiOMwtjRD0dfCHUwoe19FVA XVwFHQNo1NPe91lLayhC7WDjQgjySR9dLdltognm7QYW6oyfRPGN+69Z12G3LbXOC2 5aUvU0mgUUWB/ZX9tDlcIs4f2mfm5hUt3kA8ltQ0= From: "kargl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/109500] SIGABRT when calling a function that returns an unallocated value Date: Thu, 13 Apr 2023 15:05:39 +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: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: kargl at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109500 kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #1 from kargl at gcc dot gnu.org --- Fortunately, this is not a bug in gfortran. Unfortunately, this is a bug in your program. A function is required by the Fortran standard to have its result variable assigned when it=20 returns. If you compile your code with the=20 -Wall option, you'll see gfortran -o z -Wall a.f90 a.f90:5:2: 5 | function f() | 1 Warning: Return value of function 'f' at (1) not set [-Wreturn-type] On my system, 'z' either segfaults or prints 'T'. For 'T' the function f() is pointing to whatever is left on the stack.=