re PR inline-asm/84683 (internal compiler error: in move_for_stack_reg, at reg-stack...
authorJakub Jelinek <jakub@redhat.com>
Tue, 6 Mar 2018 09:23:36 +0000 (10:23 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 6 Mar 2018 09:23:36 +0000 (10:23 +0100)
PR inline-asm/84683
* reg-stack.c (move_for_stack_reg): If any_malformed_asm, avoid
assertion failure.

* g++.dg/ext/pr84683.C: New test.

From-SVN: r258273

gcc/ChangeLog
gcc/reg-stack.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/pr84683.C [new file with mode: 0644]

index 09123ede82061fbb4c18c4066c54b2178af5a3db..14cf229315ceecbe402f05cc576492fea8f12be8 100644 (file)
@@ -1,5 +1,9 @@
 2018-03-06  Jakub Jelinek  <jakub@redhat.com>
 
+       PR inline-asm/84683
+       * reg-stack.c (move_for_stack_reg): If any_malformed_asm, avoid
+       assertion failure.
+
        PR tree-optimization/84687
        * omp-simd-clone.c (simd_clone_create): Clear DECL_BUILT_IN_CLASS
        on new_node->decl.
index 94748965ca99e1da9741df75c8b6cd51d4643a8e..82feb5d84a02eafcf1cd7b1801dcfd62873990e2 100644 (file)
@@ -1170,7 +1170,8 @@ move_for_stack_reg (rtx_insn *insn, stack_ptr regstack, rtx pat)
          && XINT (SET_SRC (XVECEXP (pat, 0, 1)), 1) == UNSPEC_TAN)
        emit_swap_insn (insn, regstack, dest);
       else
-       gcc_assert (get_hard_regnum (regstack, dest) < FIRST_STACK_REG);
+       gcc_assert (get_hard_regnum (regstack, dest) < FIRST_STACK_REG
+                   || any_malformed_asm);
 
       gcc_assert (regstack->top < REG_STACK_SIZE);
 
index 2e5070379511012aaec98fa46fd76aece7f14ab9..edce5a57c50c83ad1328ceafa4fe735223d4b771 100644 (file)
@@ -1,5 +1,8 @@
 2018-03-06  Jakub Jelinek  <jakub@redhat.com>
 
+       PR inline-asm/84683
+       * g++.dg/ext/pr84683.C: New test.
+
        PR tree-optimization/84687
        * gcc.dg/pr84687.c: New test.
 
diff --git a/gcc/testsuite/g++.dg/ext/pr84683.C b/gcc/testsuite/g++.dg/ext/pr84683.C
new file mode 100644 (file)
index 0000000..3c66bcf
--- /dev/null
@@ -0,0 +1,13 @@
+// PR inline-asm/84683
+// { dg-do compile { target i?86-*-* x86_64-*-* } }
+// { dg-options "-O2" }
+
+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));
+    }
+}