aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-affine.c
diff options
context:
space:
mode:
authorAndrew Pinski <andrew_pinski@playstation.sony.com>2007-06-28 19:03:49 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2007-06-28 12:03:49 -0700
commitf46fe0e64cf1814ff8c60208a87d40eb31e46d87 (patch)
tree1491da5dec11ddc8e18a3642e00a9602e8072c1a /gcc/tree-affine.c
parent5346c75c5685cd351bb6d711a010ebab201b5da7 (diff)
downloadgcc-f46fe0e64cf1814ff8c60208a87d40eb31e46d87.zip
gcc-f46fe0e64cf1814ff8c60208a87d40eb31e46d87.tar.gz
gcc-f46fe0e64cf1814ff8c60208a87d40eb31e46d87.tar.bz2
re PR middle-end/32417 (416.gamess ICEs (in aff_combination_add_elt, tree-affine.c))
2007-06-28 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/32417 * tree-affine.c (aff_combination_add_elt): Handle pointer addition specially. 2007-06-28 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/32417 * gfortran.fortran-torture/compile/pr32417.f90: New test. From-SVN: r126082
Diffstat (limited to 'gcc/tree-affine.c')
-rw-r--r--gcc/tree-affine.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/gcc/tree-affine.c b/gcc/tree-affine.c
index de4cf4a..ec2ad8f 100644
--- a/gcc/tree-affine.c
+++ b/gcc/tree-affine.c
@@ -130,6 +130,7 @@ void
aff_combination_add_elt (aff_tree *comb, tree elt, double_int scale)
{
unsigned i;
+ tree type;
scale = double_int_ext_for_comb (scale, comb);
if (double_int_zero_p (scale))
@@ -169,15 +170,26 @@ aff_combination_add_elt (aff_tree *comb, tree elt, double_int scale)
return;
}
+ type = comb->type;
+ if (POINTER_TYPE_P (type))
+ type = sizetype;
+
if (double_int_one_p (scale))
- elt = fold_convert (comb->type, elt);
+ elt = fold_convert (type, elt);
else
- elt = fold_build2 (MULT_EXPR, comb->type,
- fold_convert (comb->type, elt),
- double_int_to_tree (comb->type, scale));
+ elt = fold_build2 (MULT_EXPR, type,
+ fold_convert (type, elt),
+ double_int_to_tree (type, scale));
if (comb->rest)
- comb->rest = fold_build2 (PLUS_EXPR, comb->type, comb->rest, elt);
+ {
+ if (POINTER_TYPE_P (comb->type))
+ comb->rest = fold_build2 (POINTER_PLUS_EXPR, comb->type,
+ comb->rest, elt);
+ else
+ comb->rest = fold_build2 (PLUS_EXPR, comb->type, comb->rest,
+ elt);
+ }
else
comb->rest = elt;
}