+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.
+
2019-03-19 Eric Botcazou <ebotcazou@adacore.com>
PR rtl-optimization/89753
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));
+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.
+
2019-03-19 Eric Botcazou <ebotcazou@adacore.com>
* c-c++-common/unroll-7.c: New test.
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));
+}