summaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authoraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2008-10-06 22:40:02 +0000
committeraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2008-10-06 22:40:02 +0000
commit489c40889c8be89bd5bed4b166974f8c1e01e4ee (patch)
treec9fd3853270b053ac1e6eeb3f6053b9618b9b065 /gcc/gimplify.c
parent4682b6fe285dd8c2cb48e96189e1aee558d96b17 (diff)
downloadgcc-489c40889c8be89bd5bed4b166974f8c1e01e4ee.tar.gz
+ * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140917 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 2befb43ecff..c6a79fbe8b7 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -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);