From 39307ba788ba09db3d35eb8d920085bb9aebbece Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 9 Apr 2013 12:04:24 +0200 Subject: re PR tree-optimization/56854 (error: non-decl/MEM_REF LHS in clobber statement) PR tree-optimization/56854 * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Don't forward into clobber stmts if it would change MEM_REF lhs into non-MEM_REF. * g++.dg/torture/pr56854.C: New test. From-SVN: r197625 --- gcc/tree-ssa-forwprop.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'gcc/tree-ssa-forwprop.c') diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index edcf929..26b0761 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -826,7 +826,11 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, && integer_zerop (TREE_OPERAND (lhs, 1)) && useless_type_conversion_p (TREE_TYPE (TREE_OPERAND (def_rhs, 0)), - TREE_TYPE (gimple_assign_rhs1 (use_stmt)))) + TREE_TYPE (gimple_assign_rhs1 (use_stmt))) + /* Don't forward anything into clobber stmts if it would result + in the lhs no longer being a MEM_REF. */ + && (!gimple_clobber_p (use_stmt) + || TREE_CODE (TREE_OPERAND (def_rhs, 0)) == MEM_REF)) { tree *def_rhs_basep = &TREE_OPERAND (def_rhs, 0); tree new_offset, new_base, saved, new_lhs; -- cgit v1.1