aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-pre.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2011-09-27 08:53:08 +0000
committerRichard Guenther <rguenther@suse.de>2011-09-27 08:53:08 +0000
commitb23136ddc861e343690d1cfea26dfacec0b0362e (patch)
tree9119cbca0e6b9b1947798c5560d4da7cae77f886 /gcc/tree-ssa-pre.c
parentaee8827c6c984089e0c86e2f596caa3231c49423 (diff)
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: https://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]);
}