[PATCH][mem-ref2] Fix gcc.c-torture/execute/20070919-1.c

Richard Guenther rguenther@suse.de
Tue Mar 30 13:15:00 GMT 2010


This fixes variable sized assignment gimplification.

Committed to the branch.

Richard.

2010-03-30  Richard Guenther  <rguenther@suse.de>

	* gimplify.c (mark_addressable): Handle MEM_REF.
	(gimplify_modify_expr_to_memcpy): Properly build a MEM_REF tree.

Index: gimplify.c
===================================================================
--- gimplify.c	(revision 157694)
+++ gimplify.c	(working copy)
@@ -113,10 +113,13 @@ mark_addressable (tree x)
 {
   while (handled_component_p (x))
     x = TREE_OPERAND (x, 0);
+  if (TREE_CODE (x) == MEM_REF
+      && TREE_CODE (TREE_OPERAND (x, 0)) == ADDR_EXPR)
+    x = TREE_OPERAND (TREE_OPERAND (x, 0), 0);
   if (TREE_CODE (x) != VAR_DECL
       && TREE_CODE (x) != PARM_DECL
       && TREE_CODE (x) != RESULT_DECL)
-    return ;
+    return;
   TREE_ADDRESSABLE (x) = 1;
 }
 
@@ -3127,7 +3130,7 @@ gimplify_modify_expr_to_memcpy (tree *ex
       gimple_call_set_lhs (gs, t);
       gimplify_seq_add_stmt (seq_p, gs);
 
-      *expr_p = build1 (INDIRECT_REF, TREE_TYPE (to), t);
+      *expr_p = build_simple_mem_ref (t);
       return GS_ALL_DONE;
     }
 



More information about the Gcc-patches mailing list