diff mbox

[committed] Add testcase for PR rtl-optimization/50290

Message ID 20111124152726.GK27242@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Nov. 24, 2011, 3:27 p.m. UTC
Hi!

This PR has been fixed by
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180058
This patch just adds the testcase from the PR, so it can be closed.

Tested on x86_64-linux and i686-linux, committed to trunk as obvious.

2011-11-24  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/50290
	* gcc.dg/pr50290.c: New test.


	Jakub
diff mbox

Patch

--- gcc/testsuite/gcc.dg/pr50290.c.jj	2011-11-24 13:41:06.516330291 +0100
+++ gcc/testsuite/gcc.dg/pr50290.c	2011-11-24 13:40:41.000000000 +0100
@@ -0,0 +1,27 @@ 
+/* PR rtl-optimization/50290 */
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-tree-loop-optimize -fno-tree-vrp -funroll-loops" } */
+
+static int
+bar (int t[], int b)
+{
+  int i;
+  for (i = 0; i < b; i++)
+    t[i] = i + (i > 0 ? t[i - 1] : 0);
+  return t[b - 1];
+}
+
+static int
+foo (int b)
+{
+  int x[b];
+  return bar (x, b);
+}
+
+int
+main ()
+{
+  if (foo (6) != 15)
+    __builtin_abort ();
+  return 0;
+}