public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, ice, ia64] Patch for PR middle-end/41551
@ 2009-11-23 17:42 Steve Ellcey
  2009-11-26 17:34 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Steve Ellcey @ 2009-11-23 17:42 UTC (permalink / raw)
  To: gcc-patches; +Cc: jakub


PR 41551 is an ICE on IA64, Jakub Jelinek put a proposed patch for the
defect in the bug report but didn't submit it to gcc-patches (as far as
I could tell) so I have created a patch with his change, added a
testcase and tested the patch on IA64 HP-UX and Linux with no
regressions.

OK to checkin?

Steve Ellcey
sje@cup.hp.com



2009-11-23  Steve Ellcey  <sje@cup.hp.com>
	    Jakub Jelinek <jakub@redhat.com>

	* function.c (instantiate_virtual_regs_in_insn): Copy to new reg
	before forcing mode.


Index: function.c
===================================================================
--- function.c	(revision 154430)
+++ function.c	(working copy)
@@ -1598,7 +1598,10 @@ instantiate_virtual_regs_in_insn (rtx in
       if (!safe_insn_predicate (insn_code, i, x))
 	{
 	  start_sequence ();
-	  x = force_reg (insn_data[insn_code].operand[i].mode, x);
+	  if (REG_P (x))
+	    x = copy_to_reg (x);
+	  else
+	    x = force_reg (insn_data[insn_code].operand[i].mode, x);
 	  seq = get_insns ();
 	  end_sequence ();
 	  if (seq)




2009-11-23  Steve Ellcey  <sje@cup.hp.com>

	* gcc.dg/pr41551.c: New test.


Index: gcc.dg/pr41551.c
===================================================================
--- gcc.dg/pr41551.c	(revision 0)
+++ gcc.dg/pr41551.c	(revision 0)
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+/* Make sure we do not ICE.  */
+
+int main(void)
+{
+ int var, *p = &var;
+ return (double)(unsigned long)(p);
+}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch, ice, ia64] Patch for PR middle-end/41551
  2009-11-23 17:42 [patch, ice, ia64] Patch for PR middle-end/41551 Steve Ellcey
@ 2009-11-26 17:34 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2009-11-26 17:34 UTC (permalink / raw)
  To: sje; +Cc: gcc-patches, jakub

On 11/23/2009 09:34 AM, Steve Ellcey wrote:
> +	  if (REG_P (x))
> +	    x = copy_to_reg (x);
> +	  else

I think I'd prefer we add something like

   gcc_assert (REGNO (x) <= LAST_VIRTUAL_REGISTER);

before that copy_to_reg.  Ok with that change.


r~

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-26 17:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-23 17:42 [patch, ice, ia64] Patch for PR middle-end/41551 Steve Ellcey
2009-11-26 17:34 ` Richard Henderson

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).