From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D42F2385DC1F; Mon, 13 Nov 2023 07:57:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D42F2385DC1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1699862232; bh=DKxPNFf+3UmEftGqy2PqoeObY402aCbH79Gl8Jj1OoY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GBqbGqeKKNz1n72zr8bIxkI98KIhfEF8v+DveWWkrHIKGMGsmFqnNCViMlJ9M5vmD 51iDjrEioJ20Wpj5StMdoVxEALwKv7eAbL85xrcjgPWZt4vMgDFqN5YViZyf9eVezW eHNdqBJ7/7JSp0rOe3AKsBptk61yRGlKijwM2mLY= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/112494] ICE in ix86_cc_mode, at config/i386/i386.cc:16477 Date: Mon, 13 Nov 2023 07:57:12 +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: 14.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia 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=3D112494 --- Comment #3 from Andrew Pinski --- I almost want to say this is a bug in the x86 back-end where it pushes the flags onto the stack. That is: (insn 11 8 12 2 (set (mem:DI (pre_dec:DI (reg/f:DI 7 sp)) [0 S8 A8]) (reg:DI 17 flags)) "/opt/compiler-explorer/gcc-trunk-20231112/lib/gcc/x86_64-linux-gnu/14.0.0/= include/ia32intrin.h":262:10 70 {*pushfldi2} (expr_list:REG_DEAD (reg:DI 17 flags) (nil))) (insn 12 11 20 2 (set (reg:DI 102) (mem:DI (post_inc:DI (reg/f:DI 7 sp)) [0 S8 A8])) "/opt/compiler-explorer/gcc-trunk-20231112/lib/gcc/x86_64-linux-gnu/14.0.0/= include/ia32intrin.h":262:10 66 {*popdi1} (expr_list:REG_UNUSED (reg:DI 102) (nil))) (insn 20 12 21 2 (set (reg:CCZ 17 flags) (compare:CCZ (reg/v:DI 98 [ flags1D.40416 ]) (const_int 0 [0]))) "/app/example.cpp":14:15 8 {*cmpdi_ccno_1} (expr_list:REG_EQUAL (compare:CCZ (const_int 215 [0xd7]) (const_int 0 [0])) (expr_list:REG_DEAD (reg/v:DI 98 [ flags1D.40416 ]) (nil)))) Maybe it should be represented as: (set (mem:DI (pre_dec:DI (reg/f:DI 7 sp)) [0 S8 A8]) (unspec (reg:CC 17 flags) GET_EFLAGS)) Likewise for poping: (set (reg:DI 17 flags) (mem:DI (post_inc:DI (reg/f:DI 7 sp)) [0 S8 A8])) (nil) Should really be: (set (reg:CC 17 flags) (unspec:CC (mem:DI (post_inc:DI (reg/f:DI 7 sp)) [0 S8 A8])) SET_EFLAGS))=