+ * gimplify.c (gimplify_arg): Add location argument.
authorAldy Hernandez <aldyh@redhat.com>
Mon, 6 Oct 2008 22:40:02 +0000 (22:40 +0000)
committerAldy Hernandez <aldyh@gcc.gnu.org>
Mon, 6 Oct 2008 22:40:02 +0000 (22:40 +0000)
+       * gimplify.c (gimplify_arg): Add location argument.  Use it.
+       (gimplify_call_expr): Pass location to gimplify_arg.
+       (gimplify_modify_expr_to_memcpy): Same.
+       (gimplify_modify_expr_to_memset): Same.

From-SVN: r140917

gcc/ChangeLog
gcc/gimplify.c

index a5d11b3..e7b2b50 100644 (file)
@@ -1,3 +1,10 @@
+2008-10-06  Aldy Hernandez  <aldyh@redhat.com>
+
+       * gimplify.c (gimplify_arg): Add location argument.  Use it.
+       (gimplify_call_expr): Pass location to gimplify_arg.
+       (gimplify_modify_expr_to_memcpy): Same.
+       (gimplify_modify_expr_to_memset): Same.
+
 2008-10-06  Andrew Pinski  <andrew_pinski@playstation.sony.com>
 
        * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin):
index 2befb43..c6a79fb 100644 (file)
@@ -2238,10 +2238,11 @@ maybe_with_size_expr (tree *expr_p)
 
 
 /* Helper for gimplify_call_expr.  Gimplify a single argument *ARG_P
-   Store any side-effects in PRE_P.  */
+   Store any side-effects in PRE_P.  CALL_LOCATION is the location of
+   the CALL_EXPR.  */
 
 static enum gimplify_status
-gimplify_arg (tree *arg_p, gimple_seq *pre_p)
+gimplify_arg (tree *arg_p, gimple_seq *pre_p, location_t call_location)
 {
   bool (*test) (tree);
   fallback_t fb;
@@ -2259,6 +2260,10 @@ gimplify_arg (tree *arg_p, gimple_seq *pre_p)
   /* If this is a variable sized type, we must remember the size.  */
   maybe_with_size_expr (arg_p);
 
+  /* Make sure arguments have the same location as the function call
+     itself.  */
+  protected_set_expr_location (*arg_p, call_location);
+
   /* There is a sequence point before a function call.  Side effects in
      the argument list must occur before the actual call. So, when
      gimplifying arguments, force gimplify_expr to use an internal
@@ -2448,7 +2453,8 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value)
              be the plain PARM_DECL.  */
           if ((i != 1) || !builtin_va_start_p)
             {
-              t = gimplify_arg (&CALL_EXPR_ARG (*expr_p, i), pre_p);
+              t = gimplify_arg (&CALL_EXPR_ARG (*expr_p, i), pre_p,
+                               EXPR_LOCATION (*expr_p));
 
               if (t == GS_ERROR)
                 ret = GS_ERROR;
@@ -3095,10 +3101,10 @@ gimplify_modify_expr_to_memcpy (tree *expr_p, tree size, bool want_value,
   from = TREE_OPERAND (*expr_p, 1);
 
   from_ptr = build_fold_addr_expr (from);
-  gimplify_arg (&from_ptr, seq_p);
+  gimplify_arg (&from_ptr, seq_p, EXPR_LOCATION (*expr_p));
 
   to_ptr = build_fold_addr_expr (to);
-  gimplify_arg (&to_ptr, seq_p);
+  gimplify_arg (&to_ptr, seq_p, EXPR_LOCATION (*expr_p));
 
   t = implicit_built_in_decls[BUILT_IN_MEMCPY];
 
@@ -3145,7 +3151,7 @@ gimplify_modify_expr_to_memset (tree *expr_p, tree size, bool want_value,
   to = TREE_OPERAND (*expr_p, 0);
 
   to_ptr = build_fold_addr_expr (to);
-  gimplify_arg (&to_ptr, seq_p);
+  gimplify_arg (&to_ptr, seq_p, EXPR_LOCATION (*expr_p));
   t = implicit_built_in_decls[BUILT_IN_MEMSET];
 
   gs = gimple_build_call (t, 3, to_ptr, integer_zero_node, size);