> The problem with this patch is that it causes:
> 
>   FAIL: gnat.dg/opt94.adb scan-tree-dump-times optimized "worker" 1
> 
> which is exactly the testcase from the commit which caused the bug I am
> trying to address.

Sorry about that, a thinko in the original change, I'm testing this fixlet.


        * gimplify.c (gimplify_decl_expr): Clear TREE_READONLY on the DECL
        when creating an initialization statement for it.
        * tree-inline.c (setup_one_parameter): Fix thinko in new condition.

-- 
Eric Botcazou
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 719a4e16391..5caca4bb31f 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -1822,6 +1822,7 @@ gimplify_decl_expr (tree *stmt_p, gimple_seq *seq_p)
 	  if (!TREE_STATIC (decl))
 	    {
 	      DECL_INITIAL (decl) = NULL_TREE;
+	      TREE_READONLY (decl) = 0;
 	      init = build2 (INIT_EXPR, void_type_node, decl, init);
 	      gimplify_and_add (init, seq_p);
 	      ggc_free (init);
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 8f945b88c12..1d13e7f5aca 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -3446,7 +3446,7 @@ setup_one_parameter (copy_body_data *id, tree p, tree value, tree fn,
 	 sure that it cannot be modified from another path in the callee.  */
       if ((is_gimple_min_invariant (value)
 	   || (DECL_P (value) && TREE_READONLY (value))
-	   || (auto_var_in_fn_p (value, id->src_fn)
+	   || (auto_var_in_fn_p (value, id->dst_fn)
 	       && !TREE_ADDRESSABLE (value)))
 	  && useless_type_conversion_p (TREE_TYPE (p), TREE_TYPE (value))
 	  /* We have to be very careful about ADDR_EXPR.  Make sure

Reply via email to