diff options
author | Richard Guenther <rguenther@suse.de> | 2011-07-22 11:55:30 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-07-22 11:55:30 +0000 |
commit | 27315aa68fbb97cc8cbb71da2ca54b9e8052b057 (patch) | |
tree | ca416cca45b476a17521ae6b9a7c39a71007f976 /gcc/tree-ssa-forwprop.c | |
parent | 679debeea3913242cd756be013e329ed8ab92af4 (diff) | |
download | gcc-27315aa68fbb97cc8cbb71da2ca54b9e8052b057.zip gcc-27315aa68fbb97cc8cbb71da2ca54b9e8052b057.tar.gz gcc-27315aa68fbb97cc8cbb71da2ca54b9e8052b057.tar.bz2 |
re PR middle-end/45819 (unexpected unaligned access to volatile int)
2011-07-22 Richard Guenther <rguenther@suse.de>
PR tree-optimization/45819
* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Properly
preserve volatile and notrap flags.
* gcc.dg/pr45819.c: New testcase.
From-SVN: r176623
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r-- | gcc/tree-ssa-forwprop.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index c08cb18..40db928 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -875,6 +875,8 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, } *def_rhs_basep = build2 (MEM_REF, TREE_TYPE (*def_rhs_basep), new_base, new_offset); + TREE_THIS_VOLATILE (*def_rhs_basep) = TREE_THIS_VOLATILE (lhs); + TREE_THIS_NOTRAP (*def_rhs_basep) = TREE_THIS_NOTRAP (lhs); gimple_assign_set_lhs (use_stmt, unshare_expr (TREE_OPERAND (def_rhs, 0))); *def_rhs_basep = saved; @@ -927,9 +929,9 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, tidy_after_forward_propagate_addr (use_stmt); return res; } - /* If the LHS is a plain dereference and the value type is the same as + /* If the RHS is a plain dereference and the value type is the same as that of the pointed-to type of the address we can put the - dereferenced address on the LHS preserving the original alias-type. */ + dereferenced address on the RHS preserving the original alias-type. */ else if (gimple_assign_rhs1 (use_stmt) == rhs && useless_type_conversion_p (TREE_TYPE (gimple_assign_lhs (use_stmt)), @@ -954,6 +956,8 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, } *def_rhs_basep = build2 (MEM_REF, TREE_TYPE (*def_rhs_basep), new_base, new_offset); + TREE_THIS_VOLATILE (*def_rhs_basep) = TREE_THIS_VOLATILE (rhs); + TREE_THIS_NOTRAP (*def_rhs_basep) = TREE_THIS_NOTRAP (rhs); gimple_assign_set_rhs1 (use_stmt, unshare_expr (TREE_OPERAND (def_rhs, 0))); *def_rhs_basep = saved; |