From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 402313858C41; Wed, 17 May 2023 16:49:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 402313858C41 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684342186; bh=lEhEUgZb2k500X2iAJO6G8X9fKgoHTlqW3L0B79UuzU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lm1RJNjEQMhteb8ZizY1Hb42a+hlYunMg78+U6KFk4/Fw9Lg9p9MAEA+AHdXvO0rV EPJ0TbmfuhrmUpDETRAXx874CSMK3ef+UqBLnT1VKKO0Fv1ESME16cZMXZHnUAGY+r yGqksikUdW51HRrkN0ZtW8vQrQCD6rVxR2XavMFs= From: "Gary.White at ColoState dot edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/109865] different results when routine moved inside the contains statement Date: Wed, 17 May 2023 16:49:46 +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: og12 (devel/omp/gcc-12) X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: Gary.White at ColoState dot edu X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED 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: resolution bug_status 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=3D109865 GARY.WHITE at ColoState dot edu changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|WAITING |RESOLVED --- Comment #16 from GARY.WHITE at ColoState dot edu --- I resolved the issue. The parameter ir was declared intent(out) in subrout= ine mc11ad, but there was a check in an if statement to see if ir =3D=3D 0, mea= ning ir was defined on input. This check followed code that set ir when n =3D=3D 1= , and this was never executed when the code did not produce correct answers. Any= way, changing intent(out) to intent(in out) resolved the -O3 optimization issue = and the code works as expected. I guess its too much to expect that the compiler would detect that a parame= ter was actually being access before being set if the parameter is declared intent(out) only.=