tree-optimization/108791 - checking ICE with sloppy ADDR_EXPR
The following fixes a checking ICE by choosing a more appropriate type for an ADDR_EXPR built by forwprop. PR tree-optimization/108791 * tree-ssa-forwprop.cc (optimize_vector_load): Build the ADDR_EXPR of a TARGET_MEM_REF using a more meaningful type. * gcc.dg/torture/pr108791.c: New testcase.
This commit is contained in:
parent
384dedaf65
commit
441c466fd4
2 changed files with 11 additions and 1 deletions
9
gcc/testsuite/gcc.dg/torture/pr108791.c
Normal file
9
gcc/testsuite/gcc.dg/torture/pr108791.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
/* { dg-do compile } */
|
||||
|
||||
int f (int *a(), int *b, int *c, int *d)
|
||||
{
|
||||
int s = 0;
|
||||
for (int *i = (int *)a; i < b; ++i, ++c)
|
||||
s += *c * d[*i];
|
||||
return s;
|
||||
}
|
|
@ -3299,7 +3299,8 @@ optimize_vector_load (gimple_stmt_iterator *gsi)
|
|||
{
|
||||
if (TREE_CODE (TREE_OPERAND (load_rhs, 0)) == ADDR_EXPR)
|
||||
mark_addressable (TREE_OPERAND (TREE_OPERAND (load_rhs, 0), 0));
|
||||
tree tem = make_ssa_name (TREE_TYPE (TREE_OPERAND (load_rhs, 0)));
|
||||
tree ptrtype = build_pointer_type (TREE_TYPE (load_rhs));
|
||||
tree tem = make_ssa_name (ptrtype);
|
||||
gimple *new_stmt
|
||||
= gimple_build_assign (tem, build1 (ADDR_EXPR, TREE_TYPE (tem),
|
||||
unshare_expr (load_rhs)));
|
||||
|
|
Loading…
Add table
Reference in a new issue