summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-pre.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-09-27 08:53:08 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-09-27 08:53:08 +0000
commit4b1b9be0a347af1e9acc2cfcc2db4a00d345befa (patch)
tree9119cbca0e6b9b1947798c5560d4da7cae77f886 /gcc/tree-ssa-pre.c
parent33aeac4f77c4dd4b9fac19d5b91757abdb8448f4 (diff)
downloadgcc-4b1b9be0a347af1e9acc2cfcc2db4a00d345befa.tar.gz
2011-09-27 Richard Guenther <rguenther@suse.de>
PR tree-optimization/50363 * tree-ssa-pre.c (create_expression_by_pieces): Handle pointer conversions in POINTER_PLUS_EXPRs properly. * gcc.dg/torture/pr50363.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179247 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-pre.c')
-rw-r--r--gcc/tree-ssa-pre.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index bee6ef52c6c..5c112c080a6 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -3085,11 +3085,15 @@ create_expression_by_pieces (basic_block block, pre_expr expr,
stmts, domstmt);
if (!genop[i])
return NULL_TREE;
- /* Ensure genop[1] is a ptrofftype for POINTER_PLUS_EXPR. It
- may be a constant with the wrong type. */
- if (i == 1
- && nary->opcode == POINTER_PLUS_EXPR)
- genop[i] = convert_to_ptrofftype (genop[i]);
+ /* Ensure genop[] is properly typed for POINTER_PLUS_EXPR. It
+ may have conversions stripped. */
+ if (nary->opcode == POINTER_PLUS_EXPR)
+ {
+ if (i == 0)
+ genop[i] = fold_convert (nary->type, genop[i]);
+ else if (i == 1)
+ genop[i] = convert_to_ptrofftype (genop[i]);
+ }
else
genop[i] = fold_convert (TREE_TYPE (nary->op[i]), genop[i]);
}