aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2008-10-06 22:40:02 +0000
committerAldy Hernandez <aldyh@gcc.gnu.org>2008-10-06 22:40:02 +0000
commit1282697f08f10f47e0d57d7fb5b01f66b37c35cc (patch)
treec9fd3853270b053ac1e6eeb3f6053b9618b9b065 /gcc/gimplify.c
parent38179091cc37de50c92d821b3670e94943d41bfc (diff)
downloadgcc-1282697f08f10f47e0d57d7fb5b01f66b37c35cc.zip
gcc-1282697f08f10f47e0d57d7fb5b01f66b37c35cc.tar.gz
gcc-1282697f08f10f47e0d57d7fb5b01f66b37c35cc.tar.bz2
+ * gimplify.c (gimplify_arg): Add location argument.
+ * 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
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 2befb43..c6a79fb 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);