summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/calls.c3
-rw-r--r--gcc/expr.c13
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr44941.c8
5 files changed, 28 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 118ada7e3e7..a98d044d562 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/calls.c b/gcc/calls.c
index 04892948b02..73771092a48 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -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);
diff --git a/gcc/expr.c b/gcc/expr.c
index 1ffe58977ee..3e5d18bdebc 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -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);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index fbe239847bd..202252dfb42 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44941.c b/gcc/testsuite/gcc.c-torture/compile/pr44941.c
new file mode 100644
index 00000000000..7d9cc8372fc
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr44941.c
@@ -0,0 +1,8 @@
+struct S { };
+
+extern void bar(struct S);
+
+void foo (int i)
+{
+ bar (*(struct S *)&i);
+}