re PR lto/55525 (ICE: tree check: expected array_type, have pointer_type in array_ref_low_bound, at expr.c:6768)

2012-12-05  Richard Biener  <rguenther@suse.de>

	PR lto/55525
	* gimple-streamer-in.c (input_gimple_stmt): Fixup ARRAY_REFs as well.

	* gcc.dg/lto/pr55525_0.c: New testcase.
	* gcc.dg/lto/pr55525_1.c: Likewise.

From-SVN: r194183
This commit is contained in:
Richard Biener 2012-12-05 08:47:40 +00:00 committed by Richard Biener
parent 7fb1e5929d
commit 08d8c74533
5 changed files with 34 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2012-12-05 Richard Biener <rguenther@suse.de>
PR lto/55525
* gimple-streamer-in.c (input_gimple_stmt): Fixup ARRAY_REFs as well.
2012-12-04 Ian Lance Taylor <iant@google.com>
* godump.c (find_dummy_types): Output a dummy type if we couldn't

View File

@ -148,14 +148,14 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
if (!op)
continue;
/* Fixup FIELD_DECLs in COMPONENT_REFs, they are not handled
by decl merging. */
if (TREE_CODE (op) == ADDR_EXPR)
op = TREE_OPERAND (op, 0);
while (handled_component_p (op))
{
if (TREE_CODE (op) == COMPONENT_REF)
{
/* Fixup FIELD_DECLs in COMPONENT_REFs, they are not handled
by decl merging. */
tree field, type, tem;
tree closest_match = NULL_TREE;
field = TREE_OPERAND (op, 1);
@ -215,6 +215,18 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
else
TREE_OPERAND (op, 1) = tem;
}
else if ((TREE_CODE (op) == ARRAY_REF
|| TREE_CODE (op) == ARRAY_RANGE_REF)
&& (TREE_CODE (TREE_TYPE (TREE_OPERAND (op, 0)))
!= ARRAY_TYPE))
{
/* And ARRAY_REFs to objects that had mismatched types
during symbol merging to avoid ICEs. */
TREE_OPERAND (op, 0)
= build1 (VIEW_CONVERT_EXPR,
build_array_type (TREE_TYPE (op), NULL_TREE),
TREE_OPERAND (op, 0));
}
op = TREE_OPERAND (op, 0);
}

View File

@ -1,3 +1,9 @@
2012-12-05 Richard Biener <rguenther@suse.de>
PR lto/55525
* gcc.dg/lto/pr55525_0.c: New testcase.
* gcc.dg/lto/pr55525_1.c: Likewise.
2012-12-04 Tobias Burnus <burnus@net-b.de>
* gfortran.dg/quad_3.f90: Really fix an if condition.

View File

@ -0,0 +1,8 @@
/* { dg-lto-do link } */
/* { dg-lto-options { { -flto -w } } } */
char s[8];
int main(void)
{
return strcmp(&s[1], "foo");
}

View File

@ -0,0 +1 @@
char *s = (char *) 0;