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

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

This is the failure of the new assertion added in the REG_ARGS_SIZE case of 
distribute_notes in the combiner on a degenerated case (complete folding of a 
dynamic stack allocation).  Fixed by dropping the note if the resulting insn 
is a no-op move.

Tested on i586-suse-linux, applied on the mainline.


2011-10-16  Eric Botcazou  <ebotcazou@adacore.com>

	PR rtl-optimization/50615
	* combine.c (distribute_notes) <REG_ARGS_SIZE>: Skip if I3 is a no-op.


2011-10-16  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc.dg/vla-23.c: New test.


-- 
Eric Botcazou

[-- Attachment #2: pr50615.diff --]
[-- Type: text/x-diff, Size: 969 bytes --]

Index: combine.c
===================================================================
--- combine.c	(revision 179844)
+++ combine.c	(working copy)
@@ -13274,13 +13274,14 @@ distribute_notes (rtx notes, rtx from_in
 	  break;
 
 	case REG_ARGS_SIZE:
-	  {
-	    /* ??? How to distribute between i3-i1.  Assume i3 contains the
-	       entire adjustment.  Assert i3 contains at least some adjust.  */
-	    int old_size, args_size = INTVAL (XEXP (note, 0));
-	    old_size = fixup_args_size_notes (PREV_INSN (i3), i3, args_size);
-	    gcc_assert (old_size != args_size);
-	  }
+	  /* ??? How to distribute between i3-i1.  Assume i3 contains the
+	     entire adjustment.  Assert i3 contains at least some adjust.  */
+	  if (!noop_move_p (i3))
+	    {
+	      int old_size, args_size = INTVAL (XEXP (note, 0));
+	      old_size = fixup_args_size_notes (PREV_INSN (i3), i3, args_size);
+	      gcc_assert (old_size != args_size);
+	    }
 	  break;
 
 	case REG_NORETURN:

[-- Attachment #3: vla-23.c --]
[-- Type: text/x-csrc, Size: 239 bytes --]

/* PR rtl-optimization/50615 */
/* Testcase by Zdenek Sojka <zsojka@seznam.cz> */

/* { dg-do compile } */
/* { dg-options "-O --param max-cse-insns=1" } */

int
foo (int a)
{
  if (!a)
    return 1;

  {
    int s[a];
    return 0;
  }
}

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

only message in thread, other threads:[~2011-10-16 13:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-16 15:47 Fix PR rtl-optimization/50615 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).