From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2BC953858C2A; Mon, 23 Oct 2023 21:45:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BC953858C2A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698097527; bh=pENEimopipYlIWzN2ssc5AMgRWJo+UG03MyqzuQ9lsk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=fzWTbxrC1OHGfs3IEjZUl2O95RYN+XnN3pO7bZ+P2wp5cT3CJUpnMzy01UgcDqYyc uJrQN0QtUapiclWuo+pAACACtWxIODzhDKN1dNWbeNtWaR2XODIJgFd8CyIFXK2eDj 7ggG1SY3DPaf5R46KbGj3JD9mmrWLiZ92OMFk+NE= From: "kargl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/30409] [fortran] missed optimization with pure function arguments Date: Mon, 23 Oct 2023 21:45:27 +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: 4.3.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: kargl at gcc dot gnu.org X-Bugzilla-Status: NEW 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D30409 --- Comment #12 from kargl at gcc dot gnu.org --- (In reply to anlauf from comment #11) > (In reply to kargl from comment #10) > > (In reply to anlauf from comment #8) >=20 > > which is equivalent to=20 > >=20 > > tmp =3D 1 / y > > do i =3D 1, n > > ... =3D expression1(..., tmp) > > end do >=20 > No. Strictly speaking, it is only equivalent to: >=20 > if (n > 0) tmp =3D 1 / y > do i =3D 1, n > ... =3D expression1(..., tmp) > end do Ah, yes, I missed the possibility that the loop may not loop at all.=