re PR rtl-optimization/44941 (ICE: RTL check: expected code 'mem', have 'reg' in emit_block_move_hints, at expr.c:1189)

2010-07-19  Richard Guenther  <rguenther@suse.de>

	PR middle-end/44941
	* expr.c (emit_block_move_hints): Move zero size check first.
	Move asserts to more useful places.
	* calls.c (load_register_parameters): Check for zero size.

	* gcc.c-torture/compile/pr44941.c: New testcase.

From-SVN: r162308
This commit is contained in:
Richard Guenther 2010-07-19 15:39:51 +00:00 committed by Richard Biener
parent ab73eba8bf
commit 8b4c365c56
5 changed files with 28 additions and 8 deletions

View File

@ -1,3 +1,10 @@
2010-07-19 Richard Guenther <rguenther@suse.de>
PR middle-end/44941
* expr.c (emit_block_move_hints): Move zero size check first.
Move asserts to more useful places.
* calls.c (load_register_parameters): Check for zero size.
2010-07-19 Richard Henderson <rth@redhat.com>
* tree-optimize.c (execute_all_early_local_passes): New. Change

View File

@ -1668,7 +1668,8 @@ load_register_parameters (struct arg_data *args, int num_actuals,
emit_move_insn (gen_rtx_REG (word_mode, REGNO (reg) + j),
args[i].aligned_regs[j]);
else if (partial == 0 || args[i].pass_on_stack)
else if ((partial == 0 || args[i].pass_on_stack)
&& size != 0)
{
rtx mem = validize_mem (args[i].value);

View File

@ -1120,6 +1120,11 @@ emit_block_move_hints (rtx x, rtx y, rtx size, enum block_op_methods method,
rtx retval = 0;
unsigned int align;
gcc_assert (size);
if (CONST_INT_P (size)
&& INTVAL (size) == 0)
return 0;
switch (method)
{
case BLOCK_OP_NORMAL:
@ -1143,13 +1148,10 @@ emit_block_move_hints (rtx x, rtx y, rtx size, enum block_op_methods method,
gcc_unreachable ();
}
gcc_assert (MEM_P (x) && MEM_P (y));
align = MIN (MEM_ALIGN (x), MEM_ALIGN (y));
gcc_assert (align >= BITS_PER_UNIT);
gcc_assert (MEM_P (x));
gcc_assert (MEM_P (y));
gcc_assert (size);
/* Make sure we've got BLKmode addresses; store_one_arg can decide that
block copy is more efficient for other large modes, e.g. DCmode. */
x = adjust_address (x, BLKmode, 0);
@ -1159,9 +1161,6 @@ emit_block_move_hints (rtx x, rtx y, rtx size, enum block_op_methods method,
can be incorrect is coming from __builtin_memcpy. */
if (CONST_INT_P (size))
{
if (INTVAL (size) == 0)
return 0;
x = shallow_copy_rtx (x);
y = shallow_copy_rtx (y);
set_mem_size (x, size);

View File

@ -1,3 +1,8 @@
2010-07-19 Richard Guenther <rguenther@suse.de>
PR middle-end/44941
* gcc.c-torture/compile/pr44941.c: New testcase.
2010-07-19 Jason Merrill <jason@redhat.com>
PR c++/44969

View File

@ -0,0 +1,8 @@
struct S { };
extern void bar(struct S);
void foo (int i)
{
bar (*(struct S *)&i);
}