]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/44941 (ICE: RTL check: expected code 'mem', have 'reg' in...
authorRichard Guenther <rguenther@suse.de>
Mon, 19 Jul 2010 15:39:51 +0000 (15:39 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 19 Jul 2010 15:39:51 +0000 (15:39 +0000)
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

gcc/ChangeLog
gcc/calls.c
gcc/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr44941.c [new file with mode: 0644]

index 118ada7e3e7019502396b2f270a5c022e2e7c0df..a98d044d562aa5f43602f07c59675ff1f6fe204b 100644 (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
index 04892948b024ce0f373724c3dc508bb464d0c782..73771092a4887baf29d60966d7762209addc9ffa 100644 (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);
 
index 1ffe58977eec9b85500be2e3446917cebe7609e8..3e5d18bdebc7639d6622b3f1567ed3b0d628e3d5 100644 (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);
index fbe239847bdaee56c99dd88a92c2792447492946..202252dfb42ec3e12aedf085c498a807e7eb078e 100644 (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
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44941.c b/gcc/testsuite/gcc.c-torture/compile/pr44941.c
new file mode 100644 (file)
index 0000000..7d9cc83
--- /dev/null
@@ -0,0 +1,8 @@
+struct S { };
+
+extern void bar(struct S);
+
+void foo (int i)
+{
+  bar (*(struct S *)&i);
+}