diff mbox

Small tweak to gimplify_variable_sized_compare

Message ID 201010230138.24424.ebotcazou@adacore.com
State New
Headers show

Commit Message

Eric Botcazou Oct. 22, 2010, 11:38 p.m. UTC
The transformation performed in the function drops the source location info.

Tested on x86_64-suse-linux, applied on the mainline as obvious.


2010-10-22  Eric Botcazou  <ebotcazou@adacore.com>

	* gimplify.c (gimplify_variable_sized_compare): Preserve the source
	location info of the expression.
diff mbox

Patch

Index: gimplify.c
===================================================================
--- gimplify.c	(revision 165750)
+++ gimplify.c	(working copy)
@@ -4634,10 +4634,10 @@  gimplify_modify_expr (tree *expr_p, gimp
 static enum gimplify_status
 gimplify_variable_sized_compare (tree *expr_p)
 {
+  location_t loc = EXPR_LOCATION (*expr_p);
   tree op0 = TREE_OPERAND (*expr_p, 0);
   tree op1 = TREE_OPERAND (*expr_p, 1);
-  tree t, arg, dest, src;
-  location_t loc = EXPR_LOCATION (*expr_p);
+  tree t, arg, dest, src, expr;
 
   arg = TYPE_SIZE_UNIT (TREE_TYPE (op0));
   arg = unshare_expr (arg);
@@ -4646,8 +4646,11 @@  gimplify_variable_sized_compare (tree *e
   dest = build_fold_addr_expr_loc (loc, op0);
   t = implicit_built_in_decls[BUILT_IN_MEMCMP];
   t = build_call_expr_loc (loc, t, 3, dest, src, arg);
-  *expr_p
+
+  expr
     = build2 (TREE_CODE (*expr_p), TREE_TYPE (*expr_p), t, integer_zero_node);
+  SET_EXPR_LOCATION (expr, loc);
+  *expr_p = expr;
 
   return GS_OK;
 }