------- Comment #2 from rguenth at gcc dot gnu dot org  2006-06-13 11:53 -------
The inliner needs this temporary appearantly.  Otherwise you'll get

bar ()
{
  int D.1524;

<bb 2>:
  if (D.1524 != 0) goto <L0>; else goto <L1>;

<L0>:;
  abort ();

<L1>:;
  return;

}

out of

inline int foo () { return 0; }
void bar()
{
  if (foo())
    abort ();
}

i.e. it misses to initialize the temporary with the result.  Otherwise you
can play with variants of the following patch:

Index: gimplify.c
===================================================================
*** gimplify.c  (revision 114599)
--- gimplify.c  (working copy)
*************** gimplify_return_expr (tree stmt, tree *p
*** 1111,1116 ****
--- 1111,1124 ----
    if (!result_decl
        || aggregate_value_p (result_decl, TREE_TYPE (current_function_decl)))
      result = result_decl;
+   else if (/*is_gimple_formal_tmp_reg (TREE_OPERAND (ret_expr, 1))
+            ||*/ is_gimple_min_invariant (TREE_OPERAND (ret_expr, 1))
+          /*is_gimple_val (TREE_OPERAND (ret_expr, 1))*/)
+     {
+       TREE_OPERAND (stmt, 0) = TREE_OPERAND (ret_expr, 1);
+ 
+       return GS_ALL_DONE;
+     }
    else if (gimplify_ctxp->return_temp)
      result = gimplify_ctxp->return_temp;
    else


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27798

Reply via email to