From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C1AAE3894C23; Wed, 23 Sep 2020 19:35:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C1AAE3894C23 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1600889749; bh=b7zWM3H2qza939sd97zrsoc44LivOzk3ZlLINhVur84=; h=From:To:Subject:Date:In-Reply-To:References:From; b=wqVPNGuZsZaLrN898noCuBIbIWOUSBWyAuvs2SkQXAFC6wo5IQMGAFqaZjpZWA6Bn lIhIDmv92wHpggdik+0PeapPTGSmaUwPZ/ErdglJH+9gM+bqfPg/i4D/RakLzvfLAP yrPV1JUNHIbAfDgBBBwkRJZ8uDx68PyaJdcBP/Rc= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/97176] Cannot return deferred length strings when using -fno-automatic Date: Wed, 23 Sep 2020 19:35:49 +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: 10.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf 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: 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: Wed, 23 Sep 2020 19:35:49 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97176 --- Comment #2 from anlauf at gcc dot gnu.org --- (In reply to kargl from comment #1) > Workaround 3. >=20 > Explicitly give entities the SAVE attribute whereby your > testfunc() becomes >=20 > function testfunc(string) result(res) > character(:), allocatable, save :: res > character(*), intent(in) :: string > res =3D string > end function testfunc That is explicit standard violation. Adding a blank SAVE statement in the function body seems to work as expecte= d, so a user who believes in -fno-automatic may call it a gfortran bug. Personally, I'd recommend: Workaround 4. Never use -fno-automatic.=