public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Roger Sayle <sayle@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-2653] PR target/106877: Robustify reg-stack to malformed asm. Date: Tue, 13 Sep 2022 18:50:38 +0000 (GMT) [thread overview] Message-ID: <20220913185038.BA17C3858D39@sourceware.org> (raw) https://gcc.gnu.org/g:ff85f0afc7d5684378944f88a9bc9b931034788b commit r13-2653-gff85f0afc7d5684378944f88a9bc9b931034788b Author: Roger Sayle <roger@nextmovesoftware.com> Date: Tue Sep 13 19:49:20 2022 +0100 PR target/106877: Robustify reg-stack to malformed asm. This patch resolves PR target/106877 an ICE-on-invalid inline-asm regression. An innocent upstream change means that the test case from PR inline-asm/84683 now hits a different assert in reg-stack.cc's move_for_stack_reg. Fixed by duplicating Jakub's solution to PR 84683 https://gcc.gnu.org/pipermail/gcc-patches/2018-March/495193.html at this second (similar) gcc_assert. 2022-09-13 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog PR target/106877 * reg-stack.cc (move_for_stack_reg): Check for any_malformed_asm in gcc_assert. gcc/testsuite/ChangeLog PR target/106877 * g++.dg/ext/pr106877.C: New test case. Diff: --- gcc/reg-stack.cc | 3 ++- gcc/testsuite/g++.dg/ext/pr106877.C | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/gcc/reg-stack.cc b/gcc/reg-stack.cc index fd032501ad9..95e0e614e46 100644 --- a/gcc/reg-stack.cc +++ b/gcc/reg-stack.cc @@ -1073,7 +1073,8 @@ move_for_stack_reg (rtx_insn *insn, stack_ptr regstack, rtx pat) break; /* The destination must be dead, or life analysis is borked. */ - gcc_assert (get_hard_regnum (regstack, dest) < FIRST_STACK_REG); + gcc_assert (get_hard_regnum (regstack, dest) < FIRST_STACK_REG + || any_malformed_asm); /* If the source is not live, this is yet another case of uninitialized variables. Load up a NaN instead. */ diff --git a/gcc/testsuite/g++.dg/ext/pr106877.C b/gcc/testsuite/g++.dg/ext/pr106877.C new file mode 100644 index 00000000000..6bffed9beae --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/pr106877.C @@ -0,0 +1,13 @@ +// PR target/106877 +// { dg-do compile { target i?86-*-* x86_64-*-* } } +// { dg-options "-O1 -m16 -mtune=sandybridge -flive-range-shrinkage -fno-dce" } + +void +foo (float b, double c) +{ + for (int e = 0; e < 2; e++) + { + asm volatile ("" : "+f" (c)); // { dg-error "must specify a single register" } + asm ("" : "+rm" (c = b)); + } +}
reply other threads:[~2022-09-13 18:50 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220913185038.BA17C3858D39@sourceware.org \ --to=sayle@gcc.gnu.org \ --cc=gcc-cvs@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).