From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 25E40386100B; Fri, 16 Oct 2020 14:51:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 25E40386100B From: "jamborm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/97456] [10/11 Regression] An incorrect optimization causes a function to always return the same value when using -flto Date: Fri, 16 Oct 2020 14:51:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 10.1.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jamborm at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.3 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: Fri, 16 Oct 2020 14:51:04 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97456 --- Comment #4 from Martin Jambor --- Looking at Martin's reduced testcase.... (In reply to Richard Biener from comment #2) > Confirmed with -fwhole-program -O3 IPA SRA messes things up here cloning > wrong > and producing the strange >=20 > wrong.isra (floatD.41 ISRA.85D.75004) > { [...] >=20 > [local count: 1073741824]: >=20 > [local count: 1073741824]: > _1 =3D ISRA.85_10(D); >=20 > eventually mixing up param/replacement here? ...this is simple conversion of a parameter passed by reference to one passed by value. I'm good at overlooking things but at least at the moment I cannot see anything wrong with it. Rather, I believe it is cplxlower1 which turns [local count: 1073741824]: a$_M_value_21 =3D COMPLEX_EXPR ; into: [local count: 1073741824]: a$_M_value_21 =3D COMPLEX_EXPR ; i.e. it replaces two uses of the parameter default-def with two uninitialized value variable default-defs. When I disable IPA-SRA, the pass starts with: [local count: 1073741824]: _1 =3D *pos_6(D); a$_M_value_21 =3D COMPLEX_EXPR <_1, _1>; and changes it into: [local count: 1073741824]: a$_M_value$real_1 =3D *pos_6(D); a$_M_value_21 =3D COMPLEX_EXPR ; ...so my hypothesis is that cplxlower does not handle good default-defs properly.=