Patchwork [middle-end] : FIX PR55253, [4.8 Regression] FAIL: gcc.target/i386/pr44948-2a.c

login
register
mail settings
Submitter Uros Bizjak
Date Nov. 7, 2012, 10:08 p.m.
Message ID <CAFULd4agWkmyJbts0wWatKYat+YQHFgbSfbjtWnSQj=gg-JLUg@mail.gmail.com>
Download mbox | patch
Permalink /patch/197732/
State New
Headers show

Comments

Uros Bizjak - Nov. 7, 2012, 10:08 p.m.
Hello!

Attached patch fixes an oversight, introduced in Revision 192641 [1]
that caused following testsuite failure on i686:

FAIL: gcc.target/i386/pr44948-2a.c (internal compiler error)
FAIL: gcc.target/i386/pr44948-2a.c (test for excess errors)

As shown in the PR [2], the referred patch activated the call to
emit_block_move that was previously effectively dead code (see how
modes of temp and target are checked). emit_block_move ICEs when
constant is passed to it, so we got ICE for following arguments:

(gdb) p debug_rtx (x)
(mem/j/c:BLK (plus:SI (reg/f:SI 54 virtual-stack-vars)
        (const_int -16 [0xfffffffffffffff0])) [0 a.V4SF+0 S16 A128])
$1 = void
(gdb) p debug_rtx (y)
(const_vector:V4SF [
        (const_double:SF 0.0 [0x0.0p+0])
        (const_double:SF 1.0e+0 [0x0.8p+1])
        (const_double:SF 2.0e+0 [0x0.8p+2])
        (const_double:SF 3.0e+0 [0x0.cp+2])
    ])
$2 = void

The patch simply removes the call to emit_block_move, while still
calling copy_blkmode_from_reg when appropriate. The patch fixes the
testsuite failure and produces the same code as gcc-4.7.

2012-11-07  Uros Bizjak  <ubizjak@gmail.com>

	PR middle-end/55235
	* expr.c (store_expr): Do not call emit_block_move for
	non-BLKmode values.

Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32}.

OK for mainline?

[1] http://gcc.gnu.org/ml/gcc-cvs/2012-10/msg00764.html
[2] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55235#c3

Uros.
Uros Bizjak - Nov. 7, 2012, 10:32 p.m.
On Wed, Nov 7, 2012 at 11:08 PM, Uros Bizjak <ubizjak@gmail.com> wrote:

> The patch simply removes the call to emit_block_move, while still
> calling copy_blkmode_from_reg when appropriate. The patch fixes the
> testsuite failure and produces the same code as gcc-4.7.
>
> 2012-11-07  Uros Bizjak  <ubizjak@gmail.com>
>
>         PR middle-end/55235
>         * expr.c (store_expr): Do not call emit_block_move for
>         non-BLKmode values.
>
> Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32}.
>
> OK for mainline?

Oh, I didn't notice that Eric already approved the patch in the PR.
Although he thinks the "feature" that the patch fixes is a bit
controversial, it actually restores previous functionality.

So, committed to mainline SVN.

Uros.

Patch

Index: expr.c
===================================================================
--- expr.c	(revision 193296)
+++ expr.c	(working copy)
@@ -5246,19 +5246,12 @@  store_expr (tree exp, rtx target, int call_param_p
 	{
 	  if (GET_MODE (target) == BLKmode)
 	    {
-	      if (REG_P (temp))
-	        {
-		  if (TREE_CODE (exp) == CALL_EXPR)
-		    copy_blkmode_from_reg (target, temp, TREE_TYPE (exp));
-		  else
-		    store_bit_field (target,
-				     INTVAL (expr_size (exp)) * BITS_PER_UNIT,
-				     0, 0, 0, GET_MODE (temp), temp);
-		}
+	      if (REG_P (temp) && TREE_CODE (exp) == CALL_EXPR)
+		copy_blkmode_from_reg (target, temp, TREE_TYPE (exp));
 	      else
-		emit_block_move (target, temp, expr_size (exp),
-				 (call_param_p
-				  ? BLOCK_OP_CALL_PARM : BLOCK_OP_NORMAL));
+		store_bit_field (target,
+				 INTVAL (expr_size (exp)) * BITS_PER_UNIT,
+				 0, 0, 0, GET_MODE (temp), temp);
 	    }
 	  else
 	    convert_move (target, temp, TYPE_UNSIGNED (TREE_TYPE (exp)));