From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 740A83858C29; Mon, 8 Jan 2024 14:50:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 740A83858C29 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704725430; bh=arVaE6RkRdQ67tTS4Nc0REZVBDaL9Gdas5qfwLgJJGs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=w+K/sWPSUjFom8knajmSlGofBs/OPnuAvinvE5Gc6VGTItgTt8mesIV2f/3r8Uzl5 su0kcFy7MrfeFtdmuGwVOf5uU8qNIbTyT5XTh01kgmWoVB6ovTMmR1eE40ZomVN1cW 2fkeEGxA2N3+EqMFHZBH8Va6Kkc2b73t/ElqBRxQ= From: "acoplan at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/113077] [14 Regression] ICE in dwarf2out_frame_debug_cfa_offset with `-O2 -fstack-protector-strong -fstack-clash-protection` Date: Mon, 08 Jan 2024 14:50:29 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: acoplan at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: acoplan at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.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=3D113077 --- Comment #4 from Alex Coplan --- So pro_and_epilogue has: ``` (insn/f 55 54 56 2 (set (mem/c:DI (plus:DI (reg/f:DI 31 sp) (const_int 16 [0x10])) [2 S8 A8]) (reg:DI 19 x19)) "t.c":2:28 -1 (expr_list:REG_CFA_OFFSET (set (mem/c:DI (plus:DI (reg/f:DI 31 sp) (const_int 16 [0x10])) [2 S8 A8]) (reg:DI 19 x19)) (nil))) (insn/f 56 55 57 2 (set (reg:DI 13 x13) (plus:DI (reg/f:DI 31 sp) (const_int -1048576 [0xfffffffffff00000]))) "t.c":2:28 -1 (expr_list:REG_CFA_DEF_CFA (plus:DI (reg:DI 13 x13) (const_int 1048576 [0x100000])) (nil))) (insn/f 57 56 58 2 (set (reg/f:DI 31 sp) (unspec_volatile:DI [ (reg/f:DI 31 sp) (reg:DI 13 x13) ] UNSPECV_PROBE_STACK_RANGE)) "t.c":2:28 -1 (expr_list:REG_CFA_DEF_CFA (plus:DI (reg/f:DI 31 sp) (const_int 1048576 [0x100000])) (nil))) ``` which seems fine because in insn 55 the sp is the CFA, insn 56 changes the CFA to x13, and insn 57 changes it back to sp. But by the time we get to dwarf2 we have: ``` (insn/f 56 54 55 (set (reg:DI 13 x13) (plus:DI (reg/f:DI 31 sp) (const_int -1048576 [0xfffffffffff00000]))) "t.c":2:28 120 {*adddi3_aarch64} (expr_list:REG_CFA_DEF_CFA (plus:DI (reg:DI 13 x13) (const_int 1048576 [0x100000])) (nil))) (insn/f:TI 55 56 57 (set (mem/c:DI (plus:DI (reg/f:DI 31 sp) (const_int 16 [0x10])) [2 S8 A8]) (reg:DI 19 x19)) "t.c":2:28 70 {*movdi_aarch64} (expr_list:REG_DEAD (reg:DI 19 x19) (expr_list:REG_CFA_OFFSET (set (mem/c:DI (plus:DI (reg/f:DI 31 sp) (const_int 16 [0x10])) [2 S8 A8]) (reg:DI 19 x19)) (nil)))) (insn/f 57 55 58 (set (reg/f:DI 31 sp) (unspec_volatile:DI [ (reg/f:DI 31 sp) (reg:DI 13 x13) ] UNSPECV_PROBE_STACK_RANGE)) "t.c":2:28 1151 {probe_stack_rang= e} (expr_list:REG_DEAD (reg:DI 13 x13) (expr_list:REG_CFA_DEF_CFA (plus:DI (reg/f:DI 31 sp) (const_int 1048576 [0x100000])) (nil)))) ``` i.e. the insns have been re-ordered, so now the CFA gets changed to x13 in insn 56 and so the `REG_CFA_OFFSET` note in insn 55 becomes invalid, because the CFA is no longer the sp when we process that insn. Not immediately sure what the right fix is, will investigate further.=