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 Biener <rguenth@gcc.gnu.org>2011-09-27 08:53:08 +0000
commit48acf1b78b128d2cace0705d159db7e2791756cf (patch)
tree9119cbca0e6b9b1947798c5560d4da7cae77f886 /gcc/tree-ssa-pre.c
parentddfd2edf327e1866603b825cc1c1d6a3d3cf48f4 (diff)
downloadgcc-48acf1b78b128d2cace0705d159db7e2791756cf.zip
gcc-48acf1b78b128d2cace0705d159db7e2791756cf.tar.gz
gcc-48acf1b78b128d2cace0705d159db7e2791756cf.tar.bz2
re PR tree-optimization/50363 (internal compiler error: verify_gimple failed)
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. From-SVN: r179247
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 bee6ef5..5c112c0 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]);
}