re PR middle-end/47370 (error: invalid first operand of MEM_REF)
2011-01-20 Richard Guenther <rguenther@suse.de> PR middle-end/47370 * tree-inline.c (remap_gimple_op_r): Recurse manually for the pointer operand of MEM_REFs. * gcc.dg/torture/pr47370.c: New testcase. From-SVN: r169055
This commit is contained in:
parent
28fc44f389
commit
93e452edc6
|
@ -1,3 +1,9 @@
|
|||
2011-01-20 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR middle-end/47370
|
||||
* tree-inline.c (remap_gimple_op_r): Recurse manually for
|
||||
the pointer operand of MEM_REFs.
|
||||
|
||||
2011-01-20 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/46130
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2011-01-20 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR middle-end/47370
|
||||
* gcc.dg/torture/pr47370.c: New testcase.
|
||||
|
||||
2011-01-20 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/46130
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/* { dg-do compile } */
|
||||
|
||||
struct S { int s; };
|
||||
|
||||
void
|
||||
foo (void)
|
||||
{
|
||||
for (;;)
|
||||
;
|
||||
}
|
||||
|
||||
struct S
|
||||
bar (void)
|
||||
{
|
||||
struct S s = { 99 };
|
||||
return s;
|
||||
}
|
||||
|
||||
void
|
||||
baz (int i)
|
||||
{
|
||||
struct S s[1];
|
||||
s[0] = bar ();
|
||||
bar ();
|
||||
foo ();
|
||||
}
|
||||
|
|
@ -811,23 +811,14 @@ remap_gimple_op_r (tree *tp, int *walk_subtrees, void *data)
|
|||
knows not to copy VAR_DECLs, etc., so this is safe. */
|
||||
if (TREE_CODE (*tp) == MEM_REF)
|
||||
{
|
||||
/* We need to re-canonicalize MEM_REFs from inline substitutions
|
||||
that can happen when a pointer argument is an ADDR_EXPR. */
|
||||
tree decl = TREE_OPERAND (*tp, 0);
|
||||
tree *n;
|
||||
|
||||
/* See remap_ssa_name. */
|
||||
if (TREE_CODE (decl) == SSA_NAME
|
||||
&& TREE_CODE (SSA_NAME_VAR (decl)) == RESULT_DECL
|
||||
&& id->transform_return_to_modify)
|
||||
decl = SSA_NAME_VAR (decl);
|
||||
|
||||
n = (tree *) pointer_map_contains (id->decl_map, decl);
|
||||
if (n)
|
||||
{
|
||||
tree ptr = TREE_OPERAND (*tp, 0);
|
||||
tree old = *tp;
|
||||
tree ptr = unshare_expr (*n);
|
||||
tree tem;
|
||||
|
||||
/* We need to re-canonicalize MEM_REFs from inline substitutions
|
||||
that can happen when a pointer argument is an ADDR_EXPR.
|
||||
Recurse here manually to allow that. */
|
||||
walk_tree (&ptr, remap_gimple_op_r, data, NULL);
|
||||
if ((tem = maybe_fold_offset_to_reference (EXPR_LOCATION (*tp),
|
||||
ptr,
|
||||
TREE_OPERAND (*tp, 1),
|
||||
|
@ -862,7 +853,6 @@ remap_gimple_op_r (tree *tp, int *walk_subtrees, void *data)
|
|||
*walk_subtrees = 0;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Here is the "usual case". Copy this tree node, and then
|
||||
tweak some special cases. */
|
||||
|
|
Loading…
Reference in New Issue