From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C98BC3858D33; Thu, 13 Apr 2023 12:07:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C98BC3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681387665; bh=2T/1hnVEgkgnMzgOoDgqI2zYIzF9g2vsIR5AEiNoLDs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VCsGtqyCGovDbEdCpXn4A122PPT391+sut6pqNLdm7Jndk6mLhiQGTHiRfs+M4j9m NZKl34HI3i0LdRBAs4xXFBe7JvrHZwD66b5Ju19S7UqrgLWGxdJllWX/7RPOeN+5pb R+IbKUyCIoMDrmeMHmsrigfMmNxN1M6JJL3XyxTI= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109491] [13 Regression] Segfault in tree-ssa-sccvn.cc:expressions_equal_p() Date: Thu, 13 Apr 2023 12:07:45 +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: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 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=3D109491 --- Comment #8 from Richard Biener --- So we have a NULL op, in this case (gdb) p *vro1 $4 =3D {opcode =3D TARGET_MEM_REF, clique =3D 0, base =3D 0, reverse =3D 0,= align =3D 0,=20 off =3D {coeffs =3D {-1}}, type =3D ,=20 op0 =3D , op1 =3D , op2 =3D } (gdb) p *vro2 $5 =3D {opcode =3D TARGET_MEM_REF, clique =3D 0, base =3D 0, reverse =3D 0,= align =3D 0,=20 off =3D {coeffs =3D {-1}}, type =3D ,=20 op0 =3D , op1 =3D ,=20 op2 =3D } I think we're lucky to not hit this more often (good hash!) and unlucky here (bad hash!). We used to have /* If only one of them is null, they cannot be equal. */ if (!e1 || !e2) return false; but r11-4982-g4d6b8d4213376e removed that. r11-5047-gaaccdb9cec423e fixed one case where that was previously needed. Now, for TARGET_MEM_REF a NULL operand is different from an operand with no effect (a zero) since the addressing mode is different. So canonicalization in copy_reference_ops_from_ref is unwanted (we'd use that representation for PRE insertion for example). The safest option is to restore the above check.=