Backported from mainline
2019-03-19 Jakub Jelinek <jakub@redhat.com>
+ PR target/89752
+ * gimplify.c (gimplify_asm_expr): For output argument with
+ TREE_ADDRESSABLE type, clear allows_reg if it allows memory, otherwise
+ diagnose error.
+
PR target/89726
* config/i386/i386.c (ix86_expand_floorceildf_32): In ceil
compensation use x2 += 1 instead of x2 -= -1 and when honoring
is_inout = false;
}
+ /* If we can't make copies, we can only accept memory. */
+ if (TREE_ADDRESSABLE (TREE_TYPE (TREE_VALUE (link))))
+ {
+ if (allows_mem)
+ allows_reg = 0;
+ else
+ {
+ error ("impossible constraint in %<asm%>");
+ error ("non-memory output %d must stay in memory", i);
+ return GS_ERROR;
+ }
+ }
+
if (!allows_reg && allows_mem)
mark_addressable (TREE_VALUE (link));
Backported from mainline
2019-03-19 Jakub Jelinek <jakub@redhat.com>
+ PR target/89752
+ * g++.dg/ext/asm15.C: Check for particular diagnostic wording.
+ * g++.dg/ext/asm16.C: Likewise.
+ * g++.dg/ext/asm17.C: New test.
+
PR target/89726
* gcc.target/i386/fpprec-1.c (x): Add 6 new constants.
(expect_round, expect_rint, expect_floor, expect_ceil, expect_trunc):
void
foo (S &s)
{
- __asm volatile ("" : "+r" (s) : : "memory"); // { dg-error "" }
+ __asm volatile ("" : "+r" (s) : : "memory"); // { dg-error "impossible constraint" }
+ // { dg-error "must stay in memory" "" { target *-*-* } .-1 }
}
void
foo ()
{
- __asm volatile ("" : "=r" (s) : : "memory"); // { dg-error "" }
+ __asm volatile ("" : "=r" (s) : : "memory"); // { dg-error "impossible constraint" }
+ // { dg-error "must stay in memory" "" { target *-*-* } .-1 }
}
--- /dev/null
+// PR target/89752
+// { dg-do compile }
+
+struct A { A (); ~A (); short c; };
+
+void
+foo ()
+{
+ A a0, a1;
+ __asm volatile ("" : "+rm" (a0), "+rm" (a1));
+}