From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 014783858D33; Wed, 15 Mar 2023 09:40:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 014783858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678873200; bh=LJSDjKpDd/q8B3vcwNQZCvkfoqcSykX6RcPBTbR2tp8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Dxg2TfkiGV6t35zAqFuWxA7RZmeurthxFsT9sH0tbAWslEk3E6pGbJoC3dXQIQT5K 9+0XnpAwwDWL8+bC0t5fGYnpFrisUJ1pgx0KcjovUCwuRFEZsobP1g/nw7oBlPzxVi 8f/naodI5PkyYbH46nzE3x9pmvX5fiEEEWvR/EU0= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109138] [10/11/12/13 Regression] wrong code at -O1 and above on x86_64-linux-gnu Date: Wed, 15 Mar 2023 09:39:59 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.5 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=3D109138 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|NEW |RESOLVED --- Comment #5 from Jakub Jelinek --- I don't think this has anything to do with reassoc though. The testcase looks incorrect to me. Because d is defined in the scope of the outer loop's body, for b =3D=3D 0 = a is -1U and so the inner loop does nothing, d is set to 1, a is set to 0 and then d goes out of scope. Then for b =3D 1, a scope with d variable is entered but the variable is ag= ain uninitialized, a <=3D 0 is true, and we use the uninitialized variable. fixup_cfg1 dump shows this nicely with the clobber in there: : b =3D 0; goto ; [INV] : d.0_1 =3D d; if (d.0_1 !=3D 0) goto ; [INV] else goto ; [INV] : L: a.1_2 =3D a; if (a.1_2 =3D=3D 0) goto ; [INV] else goto ; [INV] : d =3D 1; a.2_3 =3D a; _4 =3D a.2_3 + 1; a =3D _4; d =3D {CLOBBER(eol)}; b =3D b + 1; : if (b <=3D 1) goto ; [INV] else goto ; [INV] : D.2753 =3D 0; return D.2753;=