diff options
author | Richard Guenther <rguenther@suse.de> | 2011-05-23 12:08:41 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-05-23 12:08:41 +0000 |
commit | 094f6ab3d5aa9753f5fc0c36a8cdfef4c2938140 (patch) | |
tree | 517ad43ddd93528a11fead28a4b00d0da1d17b8b /gcc/tree-ssa-alias.c | |
parent | 9a9822e13ece30035ad18fed7f3946d8b1ce67a9 (diff) | |
download | gcc-094f6ab3d5aa9753f5fc0c36a8cdfef4c2938140.zip gcc-094f6ab3d5aa9753f5fc0c36a8cdfef4c2938140.tar.gz gcc-094f6ab3d5aa9753f5fc0c36a8cdfef4c2938140.tar.bz2 |
re PR tree-optimization/49115 (invalid return value optimization (?) when exception is thrown and caught)
2011-05-23 Richard Guenther <rguenther@suse.de>
PR tree-optimization/49115
* tree-ssa-alias.c (stmt_kills_ref_p_1): If the assignment
is not necessarily carried out, do not claim it kills the ref.
* tree-ssa-dce.c (mark_aliased_reaching_defs_necessary_1): Likewise.
* g++.dg/torture/pr49115.C: New testcase.
From-SVN: r174066
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r-- | gcc/tree-ssa-alias.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 315a252..ba76ae1 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -1633,7 +1633,14 @@ stmt_kills_ref_p_1 (gimple stmt, ao_ref *ref) return false; if (gimple_has_lhs (stmt) - && TREE_CODE (gimple_get_lhs (stmt)) != SSA_NAME) + && TREE_CODE (gimple_get_lhs (stmt)) != SSA_NAME + /* The assignment is not necessarily carried out if it can throw + and we can catch it in the current function where we could inspect + the previous value. + ??? We only need to care about the RHS throwing. For aggregate + assignments or similar calls and non-call exceptions the LHS + might throw as well. */ + && !stmt_can_throw_internal (stmt)) { tree base, lhs = gimple_get_lhs (stmt); HOST_WIDE_INT size, offset, max_size; |