Commit edff2a05 by Jakub Jelinek Committed by Jakub Jelinek

re PR target/89752 (ICE in emit_move_insn, at expr.c:3723)

	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.

	* g++.dg/ext/asm15.C: Check for particular diagnostic wording.
	* g++.dg/ext/asm16.C: Likewise.
	* g++.dg/ext/asm17.C: New test.

From-SVN: r269793
parent 4f683506
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
......
......@@ -6155,6 +6155,19 @@ gimplify_asm_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
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.
......
......@@ -6,5 +6,6 @@ struct S { S (); ~S (); int s; };
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 }
}
......@@ -6,5 +6,6 @@ struct S { S (); ~S (); int s[64]; } s;
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 }
}
// PR target/89752
// { dg-do compile }
struct A { A (); ~A (); short c; };
void
foo ()
{
A a0, a1;
__asm volatile ("" : "+rm" (a0), "+rm" (a1));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment