public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix PR rtl-optimization/55630
@ 2012-12-16 10:03 Eric Botcazou
  0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2012-12-16 10:03 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 877 bytes --]

This is an ICE for g++.dg/pr48660.C on HP-PA/Linux introduced by:
  http://gcc.gnu.org/ml/gcc-patches/2012-10/msg00745.html

When I wrote it, I convinced myself that the HP-PA wasn't using the BLKmode 
registers path any more and wrapped everything in PARALLELs for return values, 
so it tested the change on MIPS instead.  Now it turns out that, for sub-word 
structures, the HP-PA still uses BLKmode registers and the C++ testcase shows 
that the code doesn't correctly handle assignments from incoming return values 
to outgoing return values.  Not clear why this didn't show up on MIPS...

Tested on x86-64, HP-PA and MIPS/Linux, applied on the mainline.


2012-12-16  Eric Botcazou  <ebotcazou@adacore.com>

	PR rtl-optimization/55630
	* expr.c (expand_assignment): Do not call copy_blkmode_to_reg to move
	BLKmode return values to the return register.


-- 
Eric Botcazou

[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 722 bytes --]

Index: expr.c
===================================================================
--- expr.c	(revision 194517)
+++ expr.c	(working copy)
@@ -4920,7 +4920,12 @@ expand_assignment (tree to, tree from, b
       rtx temp;
 
       push_temp_slots ();
-      if (REG_P (to_rtx) && TYPE_MODE (TREE_TYPE (from)) == BLKmode)
+
+      /* If the source is itself a return value, it still is in a pseudo at
+	 this point so we can move it back to the return register directly.  */
+      if (REG_P (to_rtx)
+	  && TYPE_MODE (TREE_TYPE (from)) == BLKmode
+	  && TREE_CODE (from) != CALL_EXPR)
 	temp = copy_blkmode_to_reg (GET_MODE (to_rtx), from);
       else
 	temp = expand_expr (from, NULL_RTX, GET_MODE (to_rtx), EXPAND_NORMAL);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-12-16 10:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-16 10:03 Fix PR rtl-optimization/55630 Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).