Hi all,
location information is missing when rewrite complex component-wise
load/store.
This patch add the location info to fix the recently gcc.dg/uninit-13.c
and gcc.dg/uninit-17.c failures on arm target. The compiler warns
uninitialised usage at the variable's declaration location instead of
the place where it's used, because the location information is missing
when the rtx is rewritten.
arm-none-eabi test Okay, x86-64 native bootstrap Okay.
Okay for trunk?
gcc/ChangeLog:
2015-02-05 Renlin Li <renlin...@arm.com>
* tree-ssa-forwprop.c (execute): Keep location info while rewrite
complex rtx.
* tree-ssa.c (execute_update_addresses_taken): Likewise.
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index a8fbccc..9a5301e 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -2255,6 +2255,8 @@ pass_forwprop::execute (function *fun)
= gimple_build_assign (gimple_assign_lhs (use_stmt),
new_rhs);
+ location_t loc = gimple_location (use_stmt);
+ gimple_set_location (new_stmt, loc);
gimple_stmt_iterator gsi2 = gsi_for_stmt (use_stmt);
unlink_stmt_vdef (use_stmt);
gsi_remove (&gsi2, true);
@@ -2282,6 +2284,8 @@ pass_forwprop::execute (function *fun)
TREE_TYPE (TREE_TYPE (use_lhs)),
unshare_expr (use_lhs));
gimple new_stmt = gimple_build_assign (new_lhs, rhs);
+ location_t loc = gimple_location (use_stmt);
+ gimple_set_location (new_stmt, loc);
gimple_set_vuse (new_stmt, gimple_vuse (use_stmt));
gimple_set_vdef (new_stmt, make_ssa_name (gimple_vop (cfun)));
SSA_NAME_DEF_STMT (gimple_vdef (new_stmt)) = new_stmt;
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index ba6d5dd..15baf2b 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -1555,6 +1555,8 @@ execute_update_addresses_taken (void)
TREE_TYPE (other),
TREE_OPERAND (lhs, 0));
gimple load = gimple_build_assign (other, lrhs);
+ location_t loc = gimple_location (stmt);
+ gimple_set_location (load, loc);
gimple_set_vuse (load, gimple_vuse (stmt));
gsi_insert_before (&gsi, load, GSI_SAME_STMT);
gimple_assign_set_lhs (stmt, TREE_OPERAND (lhs, 0));