From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7683F3858D20; Wed, 15 May 2024 16:13:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7683F3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1715789609; bh=TCLRBRfNsqkRir17ejBfQ53eAj3U+hUDI1dqgUVeNZI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cA0fYZFBMiTxRrdhbXDuqAzKMGOLkJzCW14EShDLQQPBRJ4/8ItvfcGGAcMQcophw K1Ar+nZXvHtkgxCiKVlL/IMF4eK5sI2n4FeaRHdEp0yPQ1YV17GVUlBmlSachGDRYP Y5IoiMOvOYEdHRHyENk13hrLeUcmYf1o1qjo1OI8= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/111422] Wrong code at -O3 on x86_64-linux-gnu Date: Wed, 15 May 2024 16:13:29 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: missed-optimization, needs-bisection, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit 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=3D111422 --- Comment #6 from GCC Commits --- The master branch has been updated by Richard Biener : https://gcc.gnu.org/g:ab25eef36400e8c1d28e3ed059c5f95a38b45f17 commit r15-517-gab25eef36400e8c1d28e3ed059c5f95a38b45f17 Author: Richard Biener Date: Wed May 15 13:06:30 2024 +0200 middle-end/111422 - wrong stack var coalescing, handle PHIs The gcc.c-torture/execute/pr111422.c testcase after installing the sink pass improvement reveals that we also need to handle _65 =3D &g + _58; _44 =3D &g + _43; # _59 =3D PHI <_65, _44> *_59 =3D 8; g =3D {v} {CLOBBER(eos)}; ... n[0] =3D &f; *_59 =3D 8; g =3D {v} {CLOBBER(eos)}; where we fail to see the conflict between n and g after the first clobber of g. Before the sinking improvement there was a conflict recorded on a path where _65/_44 are unused, so the real conflict was missed but the fake one avoided the miscompile. The following handles PHI defs in add_scope_conflicts_2 which fixes the issue. PR middle-end/111422 * cfgexpand.cc (add_scope_conflicts_2): Handle PHIs by recursing to their arguments.=