re PR tree-optimization/40582 (ice for non-trivial conversion at assignment with -O2)

2009-06-30  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/40582
	* tree-sra.c (build_ref_for_offset_1): Use types_compatible_p rather
	than useless_type_conversion_p.
	(generate_subtree_copies): Increment sra_stats.subtree_copies at a
	proper place.

	* testsuite/gcc.c-torture/compile/pr40582.c: New test.

From-SVN: r149088
This commit is contained in:
Martin Jambor 2009-06-30 12:10:29 +02:00 committed by Martin Jambor
parent f57017cdbb
commit 71d4d3eb2e
4 changed files with 33 additions and 2 deletions

View File

@ -1,3 +1,11 @@
2009-06-30 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/40582
* tree-sra.c (build_ref_for_offset_1): Use types_compatible_p rather
than useless_type_conversion_p.
(generate_subtree_copies): Increment sra_stats.subtree_copies at a
proper place.
2009-06-30 Martin Jambor <mjambor@suse.cz>
PR middle-end/40554

View File

@ -1,3 +1,8 @@
2009-06-30 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/40582
* gcc.c-torture/compile/pr40582.c: New test.
2009-06-30 Wei Guozhi <carrot@google.com>
PR/40416

View File

@ -0,0 +1,18 @@
struct A
{
void* q;
short i;
};
union U
{
char* p;
struct A a;
};
struct A foo(union U u)
{
struct A a = { 0, 0 };
a = u.a;
return a;
}

View File

@ -1036,7 +1036,7 @@ build_ref_for_offset_1 (tree *res, tree type, HOST_WIDE_INT offset,
HOST_WIDE_INT el_size;
if (offset == 0 && exp_type
&& useless_type_conversion_p (exp_type, type))
&& types_compatible_p (exp_type, type))
return true;
switch (TREE_CODE (type))
@ -1760,7 +1760,6 @@ generate_subtree_copies (struct access *access, tree agg,
insert_after ? GSI_NEW_STMT
: GSI_SAME_STMT);
stmt = gimple_build_assign (expr, repl);
sra_stats.subtree_copies++;
}
if (insert_after)
@ -1768,6 +1767,7 @@ generate_subtree_copies (struct access *access, tree agg,
else
gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
update_stmt (stmt);
sra_stats.subtree_copies++;
}
if (access->first_child)