fold-const.c (try_move_mult_to_index): Remove redundant type argument.
2005-02-09 Richard Guenther <rguenth@gcc.gnu.org> * fold-const.c (try_move_mult_to_index): Remove redundant type argument. Create ADDR_EXPR with correct type. (fold): Update callers of try_move_mult_to_index. Convert result to the appropriate type. * g++.dg/tree-ssa/tmmti.C: New testcase. From-SVN: r94767
This commit is contained in:
parent
8f2bf9f18d
commit
0c6c135bb3
@ -1,3 +1,11 @@
|
||||
2005-02-09 Richard Guenther <rguenth@gcc.gnu.org>
|
||||
|
||||
PR middle-end/19854
|
||||
* fold-const.c (try_move_mult_to_index): Remove redundant
|
||||
type argument. Create ADDR_EXPR with correct type.
|
||||
(fold): Update callers of try_move_mult_to_index. Convert
|
||||
result to the appropriate type.
|
||||
|
||||
2005-02-09 Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
PR target/19597
|
||||
|
@ -6172,12 +6172,12 @@ fold_sign_changed_comparison (enum tree_code code, tree type,
|
||||
}
|
||||
|
||||
/* Tries to replace &a[idx] CODE s * delta with &a[idx CODE delta], if s is
|
||||
step of the array. TYPE is the type of the expression. ADDR is the address.
|
||||
MULT is the multiplicative expression. If the function succeeds, the new
|
||||
address expression is returned. Otherwise NULL_TREE is returned. */
|
||||
step of the array. ADDR is the address. MULT is the multiplicative expression.
|
||||
If the function succeeds, the new address expression is returned. Otherwise
|
||||
NULL_TREE is returned. */
|
||||
|
||||
static tree
|
||||
try_move_mult_to_index (tree type, enum tree_code code, tree addr, tree mult)
|
||||
try_move_mult_to_index (enum tree_code code, tree addr, tree mult)
|
||||
{
|
||||
tree s, delta, step;
|
||||
tree arg0 = TREE_OPERAND (mult, 0), arg1 = TREE_OPERAND (mult, 1);
|
||||
@ -6214,7 +6214,7 @@ try_move_mult_to_index (tree type, enum tree_code code, tree addr, tree mult)
|
||||
|
||||
/* If the type sizes do not match, we might run into problems
|
||||
when one of them would overflow. */
|
||||
if (TYPE_PRECISION (itype) != TYPE_PRECISION (type))
|
||||
if (TYPE_PRECISION (itype) != TYPE_PRECISION (TREE_TYPE (s)))
|
||||
continue;
|
||||
|
||||
if (!operand_equal_p (step, fold_convert (itype, s), 0))
|
||||
@ -6246,7 +6246,7 @@ try_move_mult_to_index (tree type, enum tree_code code, tree addr, tree mult)
|
||||
TREE_OPERAND (pos, 1),
|
||||
delta));
|
||||
|
||||
return build1 (ADDR_EXPR, type, ret);
|
||||
return build1 (ADDR_EXPR, TREE_TYPE (addr), ret);
|
||||
}
|
||||
|
||||
|
||||
@ -6944,16 +6944,16 @@ fold (tree expr)
|
||||
if (TREE_CODE (arg0) == ADDR_EXPR
|
||||
&& TREE_CODE (arg1) == MULT_EXPR)
|
||||
{
|
||||
tem = try_move_mult_to_index (type, PLUS_EXPR, arg0, arg1);
|
||||
tem = try_move_mult_to_index (PLUS_EXPR, arg0, arg1);
|
||||
if (tem)
|
||||
return fold (tem);
|
||||
return fold_convert (type, fold (tem));
|
||||
}
|
||||
else if (TREE_CODE (arg1) == ADDR_EXPR
|
||||
&& TREE_CODE (arg0) == MULT_EXPR)
|
||||
{
|
||||
tem = try_move_mult_to_index (type, PLUS_EXPR, arg1, arg0);
|
||||
tem = try_move_mult_to_index (PLUS_EXPR, arg1, arg0);
|
||||
if (tem)
|
||||
return fold (tem);
|
||||
return fold_convert (type, fold (tem));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -7332,9 +7332,9 @@ fold (tree expr)
|
||||
if (TREE_CODE (arg0) == ADDR_EXPR
|
||||
&& TREE_CODE (arg1) == MULT_EXPR)
|
||||
{
|
||||
tem = try_move_mult_to_index (type, MINUS_EXPR, arg0, arg1);
|
||||
tem = try_move_mult_to_index (MINUS_EXPR, arg0, arg1);
|
||||
if (tem)
|
||||
return fold (tem);
|
||||
return fold_convert (type, fold (tem));
|
||||
}
|
||||
|
||||
if (TREE_CODE (arg0) == MULT_EXPR
|
||||
|
@ -1,3 +1,8 @@
|
||||
2005-02-09 Richard Guenther <rguenth@gcc.gnu.org>
|
||||
|
||||
PR middle-end/19854
|
||||
* g++.dg/tree-ssa/tmmti.C: New testcase.
|
||||
|
||||
2005-02-09 Joseph S. Myers <joseph@codesourcery.com>
|
||||
|
||||
* g++.dg/rtti/tinfo1.C: Allow newline after assembler label.
|
||||
|
7
gcc/testsuite/g++.dg/tree-ssa/tmmti.C
Normal file
7
gcc/testsuite/g++.dg/tree-ssa/tmmti.C
Normal file
@ -0,0 +1,7 @@
|
||||
/* { dg-do compile } */
|
||||
|
||||
void bar(unsigned int i)
|
||||
{
|
||||
int a[4];
|
||||
char *p = (char*)&a[1] + 4*i;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user