public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "keithp at keithp dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/113795] New: armv8.1m-m.main+pacbti -mbranch-protection=standard -O2 compile error Date: Wed, 07 Feb 2024 06:09:06 +0000 [thread overview] Message-ID: <bug-113795-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113795 Bug ID: 113795 Summary: armv8.1m-m.main+pacbti -mbranch-protection=standard -O2 compile error Product: gcc Version: 13.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: keithp at keithp dot com Target Milestone: --- Created attachment 57348 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57348&action=edit Reasonably short test case. A tail-call indirect branch is miscompiled in the attached example. Without -mbranch-protection=standard: ``` .L2: ldr r4, .L25+4 movs r0, #0 ldr r4, [r4, #24] mov ip, r4 str r4, [sp, #4] add sp, sp, #28 @ sp needed pop {r4, r5, r6, r7, r8, r9, r10, fp, lr} bx ip ``` With -mbranch-protection=standard: ``` .L2: movs r0, #0 ldr r4, .L25+4 ldr r4, [r4, #24] str r4, [sp, #4] add sp, sp, #24 @ sp needed pop {r4, r5, r6, r7, r8, r9, r10, fp, ip, lr} aut ip, lr, sp bx ip ``` Note that in the latter example, the `ip` register doesn't get copied from `r4`, presumably because `ip` gets clobbered by the PAC operation. That leaves the indirect branch at the end jumping to a random address.
next reply other threads:[~2024-02-07 6:09 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-02-07 6:09 keithp at keithp dot com [this message] 2024-02-07 6:11 ` [Bug c/113795] " keithp at keithp dot com 2024-02-07 6:20 ` keithp at keithp dot com 2024-02-08 11:17 ` [Bug target/113795] " rearnsha 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-113795-4@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: linkBe 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).