Commit 8b4c365c by Richard Guenther Committed by Richard Biener

re PR rtl-optimization/44941 (ICE: RTL check: expected code 'mem', have 'reg' in…

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
parent ab73eba8
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> 2010-07-19 Richard Henderson <rth@redhat.com>
* tree-optimize.c (execute_all_early_local_passes): New. Change * tree-optimize.c (execute_all_early_local_passes): New. Change
......
...@@ -1668,7 +1668,8 @@ load_register_parameters (struct arg_data *args, int num_actuals, ...@@ -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), emit_move_insn (gen_rtx_REG (word_mode, REGNO (reg) + j),
args[i].aligned_regs[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); rtx mem = validize_mem (args[i].value);
......
...@@ -1120,6 +1120,11 @@ emit_block_move_hints (rtx x, rtx y, rtx size, enum block_op_methods method, ...@@ -1120,6 +1120,11 @@ emit_block_move_hints (rtx x, rtx y, rtx size, enum block_op_methods method,
rtx retval = 0; rtx retval = 0;
unsigned int align; unsigned int align;
gcc_assert (size);
if (CONST_INT_P (size)
&& INTVAL (size) == 0)
return 0;
switch (method) switch (method)
{ {
case BLOCK_OP_NORMAL: case BLOCK_OP_NORMAL:
...@@ -1143,13 +1148,10 @@ emit_block_move_hints (rtx x, rtx y, rtx size, enum block_op_methods method, ...@@ -1143,13 +1148,10 @@ emit_block_move_hints (rtx x, rtx y, rtx size, enum block_op_methods method,
gcc_unreachable (); gcc_unreachable ();
} }
gcc_assert (MEM_P (x) && MEM_P (y));
align = MIN (MEM_ALIGN (x), MEM_ALIGN (y)); align = MIN (MEM_ALIGN (x), MEM_ALIGN (y));
gcc_assert (align >= BITS_PER_UNIT); 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 /* 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. */ block copy is more efficient for other large modes, e.g. DCmode. */
x = adjust_address (x, BLKmode, 0); 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, ...@@ -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. */ can be incorrect is coming from __builtin_memcpy. */
if (CONST_INT_P (size)) if (CONST_INT_P (size))
{ {
if (INTVAL (size) == 0)
return 0;
x = shallow_copy_rtx (x); x = shallow_copy_rtx (x);
y = shallow_copy_rtx (y); y = shallow_copy_rtx (y);
set_mem_size (x, size); set_mem_size (x, size);
......
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> 2010-07-19 Jason Merrill <jason@redhat.com>
PR c++/44969 PR c++/44969
......
struct S { };
extern void bar(struct S);
void foo (int i)
{
bar (*(struct S *)&i);
}
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