From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 74D263858425; Wed, 24 Nov 2021 10:39:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 74D263858425 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/103404] ICE: SIGSEGV in insert_with_costs (cse.c:1569) with custom flags Date: Wed, 24 Nov 2021 10:39:27 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth 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 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: Wed, 24 Nov 2021 10:39:27 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103404 --- Comment #2 from Richard Biener --- Program received signal SIGSEGV, Segmentation fault. 0x00000000028071dc in insert_with_costs (x=3D0x7ffff6739090, classp=3D0x0,= =20 hash=3D13, mode=3DE_SImode, cost=3D0, reg_cost=3D1) at /home/rguenther/src/gcc3/gcc/cse.c:1569 1569 if (CHEAPER (elt, classp)) where classp is NULL. The passed in class is #2 0x00000000028079e7 in merge_equiv_classes (class1=3D0x40b8700,=20 class2=3D0x3f0a950) at /home/rguenther/src/gcc3/gcc/cse.c:1756 1756 new_elt =3D insert (exp, class1, hash, mode); (gdb) p *class1=20 $4 =3D {exp =3D 0x7ffff6739090, canon_exp =3D 0x0, next_same_hash =3D 0x40b= 85e0,=20 prev_same_hash =3D 0x0, next_same_value =3D 0x0, prev_same_value =3D 0x0,= =20 first_same_value =3D 0x0, related_value =3D 0x0, cost =3D 0, regcost =3D = 1,=20 mode =3D E_SImode, in_memory =3D 0 '\000', is_const =3D 0 '\000', flag = =3D 0 '\000'} It seems we remove class1 from the table while processing the merge: #0 remove_from_table (elt=3D0x40b8700, hash=3D11) at /home/rguenther/src/gcc3/gcc/cse.c:1354 #1 0x0000000002806cc5 in remove_pseudo_from_table (x=3D0x7ffff6739090, has= h=3D11) at /home/rguenther/src/gcc3/gcc/cse.c:1426 #2 0x000000000280792d in merge_equiv_classes (class1=3D0x40b8700,=20 class2=3D0x3f0a950) at /home/rguenther/src/gcc3/gcc/cse.c:1747 and note it may even get re-used via the free_element_chain so it might stay in the table but have a different purpose. Somebody more familiar with the equivalence code needs to look at this. I'd try postponing remove_pseudo_from_table until after the merge for example.=