* [PATCH] PR target/106877: Robustify reg-stack to malformed asm.
@ 2022-09-13 9:56 Roger Sayle
2022-09-13 10:14 ` Uros Bizjak
0 siblings, 1 reply; 2+ messages in thread
From: Roger Sayle @ 2022-09-13 9:56 UTC (permalink / raw)
To: 'GCC Patches'
[-- Attachment #1: Type: text/plain, Size: 866 bytes --]
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.
This patch has been tested on x86_64-pc-linux-gnu with make bootstrap
and make -k check, both with and without --target_board=unix{-m32},
with no new failures. Ok for mainline?
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.
Thanks,
Roger
--
[-- Attachment #2: patchrs.txt --]
[-- Type: text/plain, Size: 1185 bytes --]
diff --git a/gcc/reg-stack.cc b/gcc/reg-stack.cc
index fd03250..95e0e61 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 0000000..6bffed9
--- /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));
+ }
+}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] PR target/106877: Robustify reg-stack to malformed asm.
2022-09-13 9:56 [PATCH] PR target/106877: Robustify reg-stack to malformed asm Roger Sayle
@ 2022-09-13 10:14 ` Uros Bizjak
0 siblings, 0 replies; 2+ messages in thread
From: Uros Bizjak @ 2022-09-13 10:14 UTC (permalink / raw)
To: Roger Sayle; +Cc: GCC Patches
On Tue, Sep 13, 2022 at 11:57 AM Roger Sayle <roger@nextmovesoftware.com> wrote:
>
>
> 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.
>
> This patch has been tested on x86_64-pc-linux-gnu with make bootstrap
> and make -k check, both with and without --target_board=unix{-m32},
> with no new failures. Ok for mainline?
>
>
> 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.
OK.
Thanks,
Uros.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-13 10:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-13 9:56 [PATCH] PR target/106877: Robustify reg-stack to malformed asm Roger Sayle
2022-09-13 10:14 ` Uros Bizjak
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).