Commit 9f68560c by Jakub Jelinek Committed by Jakub Jelinek

re PR middle-end/38505 (Revision 142061 caused ICE on __builtin_memcpy)

	PR middle-end/38505
	* tree-ssa.c (useless_type_conversion_p_1): Return
	false if inner_type is incomplete and outer_type is complete.

	* gcc.c-torture/compile/pr38505.c: New test.

From-SVN: r142806
parent 18430d27
2008-12-18 Jakub Jelinek <jakub@redhat.com>
PR middle-end/38505
* tree-ssa.c (useless_type_conversion_p_1): Return
false if inner_type is incomplete and outer_type is complete.
2008-12-17 Sebastian Pop <sebastian.pop@amd.com>
* doc/install.texi (Prerequisites): Document PPL and CLooG-PPL
2008-12-18 Jakub Jelinek <jakub@redhat.com>
PR middle-end/38505
* gcc.c-torture/compile/pr38505.c: New test.
2008-12-17 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/auto6.C: Test more stuff.
......
/* PR middle-end/38505 */
/* { dg-do compile } */
struct S
{
unsigned short a[50];
unsigned short b[20];
};
extern void bar (struct S *);
extern void baz (unsigned short *);
extern unsigned short d[];
void
foo (void)
{
struct S s;
unsigned short g[50];
baz (g);
__builtin_memcpy (&s, g, sizeof (g));
__builtin_memcpy (s.b, d, sizeof (s.b));
bar (&s);
}
......@@ -1188,6 +1188,11 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type)
if (TREE_CODE (inner_type) != TREE_CODE (outer_type))
return false;
/* Conversion from an incomplete to a complete type is never
useless. */
if (!COMPLETE_TYPE_P (inner_type) && COMPLETE_TYPE_P (outer_type))
return false;
/* ??? This seems to be necessary even for aggregates that don't
have TYPE_STRUCTURAL_EQUALITY_P set. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment