diff options
author | Richard Guenther <rguenther@suse.de> | 2007-08-24 15:09:10 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2007-08-24 15:09:10 +0000 |
commit | fa2050d2664411f84dfdfcdcea9c509144ba0b96 (patch) | |
tree | e1badd70aec0549a564c0a232d88b4610c7d380a /gcc/tree-ssa-ccp.c | |
parent | a7d318ea7f7b816250f872bc0cb13b9cd8277cd9 (diff) | |
download | gcc-fa2050d2664411f84dfdfcdcea9c509144ba0b96.zip gcc-fa2050d2664411f84dfdfcdcea9c509144ba0b96.tar.gz gcc-fa2050d2664411f84dfdfcdcea9c509144ba0b96.tar.bz2 |
re PR tree-optimization/33166 (ICE in get_indirect_ref_operands, at tree-ssa-operands.c:1698)
2007-08-24 Richard Guenther <rguenther@suse.de>
PR middle-end/33166
* tree-ssa.c (useless_type_conversion_p): Split into a
recursive and a non-recursive part.
(useless_type_conversion_p_1): New function.
* tree-ssa-ccp.c (fold_stmt_r): Make sure that the result
from maybe_fold_offset_to_reference is trivially convertible
to the desired type before doing the simplification.
* gcc.c-torture/compile/pr33166.c: New testcase.
From-SVN: r127771
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r-- | gcc/tree-ssa-ccp.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index e6dfcd8..e0829f5 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -2060,7 +2060,12 @@ fold_stmt_r (tree *expr_p, int *walk_subtrees, void *data) (TREE_OPERAND (expr, 0), integer_zero_node, TREE_TYPE (TREE_TYPE (expr))))) - t = build_fold_addr_expr_with_type (t, TREE_TYPE (expr)); + { + tree ptr_type = build_pointer_type (TREE_TYPE (t)); + if (!useless_type_conversion_p (TREE_TYPE (expr), ptr_type)) + return NULL_TREE; + t = build_fold_addr_expr_with_type (t, ptr_type); + } break; /* ??? Could handle more ARRAY_REFs here, as a variant of INDIRECT_REF. |