public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "acoplan at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-113077-4-1dc6glC77k@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113077-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113077

--- Comment #4 from Alex Coplan <acoplan at gcc dot gnu.org> ---
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_range}
     (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.

  parent reply	other threads:[~2024-01-08 14:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-19  3:44 [Bug middle-end/113077] New: " pinskia at gcc dot gnu.org
2023-12-19  3:45 ` [Bug middle-end/113077] " pinskia at gcc dot gnu.org
2023-12-19  3:47 ` pinskia at gcc dot gnu.org
2023-12-19  3:52 ` pinskia at gcc dot gnu.org
2023-12-19  9:44 ` acoplan at gcc dot gnu.org
2024-01-08 12:51 ` [Bug target/113077] " jakub at gcc dot gnu.org
2024-01-08 14:50 ` acoplan at gcc dot gnu.org [this message]
2024-01-08 15:00 ` jakub at gcc dot gnu.org
2024-01-08 15:05 ` acoplan at gcc dot gnu.org
2024-01-09  9:13 ` acoplan at gcc dot gnu.org
2024-01-09 11:30 ` acoplan at gcc dot gnu.org
2024-01-09 15:38 ` acoplan at gcc dot gnu.org
2024-01-10  9:57 ` acoplan at gcc dot gnu.org
2024-01-10 17:02 ` acoplan at gcc dot gnu.org
2024-01-11  9:39 ` acoplan at gcc dot gnu.org
2024-01-11 10:17 ` cvs-commit at gcc dot gnu.org
2024-01-11 10:19 ` acoplan at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-113077-4-1dc6glC77k@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).