https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70370
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
So we have !allows_mem here which we can only handle if !is_inout by
emitting a store in the post-queue like
__asm__("" : "=r" tem_1);
__real f = tem_1;
The following works for me (otherwise untested sofar - eventually
the is_inout case needs to be adjusted as we have code for that below
as well).
Index: gcc/gimplify.c
===================================================================
--- gcc/gimplify.c (revision 234415)
+++ gcc/gimplify.c (working copy)
@@ -5182,9 +5196,26 @@ gimplify_asm_expr (tree *expr_p, gimple_
if (!allows_reg && allows_mem)
mark_addressable (TREE_VALUE (link));
- tret = gimplify_expr (&TREE_VALUE (link), pre_p, post_p,
- is_inout ? is_gimple_min_lval : is_gimple_lvalue,
- fb_lvalue | fb_mayfail);
+ if (!allows_mem)
+ {
+ if (is_inout)
+ tret = GS_ERROR;
+ else
+ {
+ tree tem = create_tmp_reg (TREE_TYPE (TREE_VALUE (link)));
+ tree ass = build2 (MODIFY_EXPR, TREE_TYPE (tem),
+ TREE_VALUE (link), tem);
+ gimplify_and_add (ass, post_p);
+
+ TREE_VALUE (link) = tem;
+ /* create and gimplify TREE_VALUE (link) = reg on post_p. */
+ tret = GS_OK;
+ }
+ }
+ else
+ tret = gimplify_expr (&TREE_VALUE (link), pre_p, post_p,
+ is_inout ? is_gimple_min_lval : is_gimple_lvalue,
+ fb_lvalue | fb_mayfail);
if (tret == GS_ERROR)
{
error ("invalid lvalue in asm output %d", i);