diff options
author | Richard Guenther <rguenther@suse.de> | 2009-01-16 19:18:18 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2009-01-16 19:18:18 +0000 |
commit | 786ce82d44352369486d69add3cf3695b08998a2 (patch) | |
tree | c4997b22540cbef79a66ef53490b30491bd30b3d /gcc/fold-const.c | |
parent | c1cb09ada04abbf0087eafedaab7b3ec32b23659 (diff) | |
download | gcc-786ce82d44352369486d69add3cf3695b08998a2.zip gcc-786ce82d44352369486d69add3cf3695b08998a2.tar.gz gcc-786ce82d44352369486d69add3cf3695b08998a2.tar.bz2 |
re PR tree-optimization/38835 (field-insensitive PTA causes libstdc++ miscompiles)
2009-01-16 Richard Guenther <rguenther@suse.de>
PR tree-optimization/38835
PR middle-end/36227
* fold-const.c (fold_binary): Remove PTR + INT -> (INT)(PTR p+ INT)
and INT + PTR -> (INT)(PTR p+ INT) folding.
* tree-ssa-address.c (create_mem_ref): Properly use POINTER_PLUS_EXPR.
java/
* builtins.c (build_addr_sum): Use POINTER_PLUS_EXPR.
* gcc.c-torture/execute/pr36227.c: New testcase.
* gcc.dg/tree-ssa/foldaddr-1.c: XFAIL.
* g++.dg/init/const7.C: Likewise.
From-SVN: r143442
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 32863e6..eb7d7c9 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -9864,20 +9864,6 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) return NULL_TREE; case PLUS_EXPR: - /* PTR + INT -> (INT)(PTR p+ INT) */ - if (POINTER_TYPE_P (TREE_TYPE (arg0)) - && INTEGRAL_TYPE_P (TREE_TYPE (arg1))) - return fold_convert (type, fold_build2 (POINTER_PLUS_EXPR, - TREE_TYPE (arg0), - arg0, - fold_convert (sizetype, arg1))); - /* INT + PTR -> (INT)(PTR p+ INT) */ - if (POINTER_TYPE_P (TREE_TYPE (arg1)) - && INTEGRAL_TYPE_P (TREE_TYPE (arg0))) - return fold_convert (type, fold_build2 (POINTER_PLUS_EXPR, - TREE_TYPE (arg1), - arg1, - fold_convert (sizetype, arg0))); /* A + (-B) -> A - B */ if (TREE_CODE (arg1) == NEGATE_EXPR) return fold_build2 (MINUS_EXPR, type, |