public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "nsz at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/94515] aarch64: broken unwind information for pac-ret
Date: Tue, 21 Apr 2020 14:26:42 +0000	[thread overview]
Message-ID: <bug-94515-4-UBGaiLc9QT@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94515-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #1 from nsz at gcc dot gnu.org ---
i had a fix but it's not enough, so here is another test case:

__attribute__((noreturn)) void unwind(void);
int bar(void);
int global;

int foo(int x)
{
  if (x==1) return 2;
  int y = bar();
  if (y > global) global=y;
  if (y==3) unwind();
  return 0;
}

-O2 -S -mbranch-protection=pac-ret the asm:

foo:
        .cfi_startproc
        cmp     w0, 1
        beq     .L4
        hint    25 // paciasp
        .cfi_window_save  //// pauth on
        stp     x29, x30, [sp, -16]!
        .cfi_def_cfa_offset 16
        .cfi_offset 29, -16
        .cfi_offset 30, -8
        mov     x29, sp
        bl      bar
        mov     w1, w0
        adrp    x2, .LANCHOR0
        ldr     w0, [x2, #:lo12:.LANCHOR0]
        cmp     w0, w1
        blt     .L11
.L3:
        mov     w0, 0
        cmp     w1, 3
        beq     .L12
        ldp     x29, x30, [sp], 16
        .cfi_remember_state
        .cfi_restore 30
        .cfi_restore 29
        .cfi_def_cfa_offset 0
        hint    29 // autiasp
        .cfi_window_save  //// pauth off
        ret
        .p2align 2,,3
.L11:
        .cfi_restore_state  //// pauth on
        str     w1, [x2, #:lo12:.LANCHOR0]
        b       .L3
        .p2align 2,,3
.L4:
        .cfi_def_cfa_offset 0
        .cfi_restore 29
        .cfi_restore 30
        mov     w0, 2  //// pauth should be off but it's on 
        ret
.L12:
        .cfi_def_cfa_offset 16
        .cfi_offset 29, -16
        .cfi_offset 30, -8
        bl      unwind
        .cfi_endproc

  reply	other threads:[~2020-04-21 14:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-07 11:48 [Bug target/94515] New: " nsz at gcc dot gnu.org
2020-04-21 14:26 ` nsz at gcc dot gnu.org [this message]
2020-04-27  8:11 ` [Bug target/94515] " cvs-commit at gcc dot gnu.org
2020-05-14 15:17 ` cvs-commit at gcc dot gnu.org
2020-05-14 15:48 ` cvs-commit at gcc dot gnu.org
2020-05-14 15:51 ` nsz at gcc dot gnu.org
2020-05-14 15:52 ` nsz 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-94515-4-UBGaiLc9QT@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).