Patchwork testcase for PR56407

login
register
mail settings
Submitter Richard Guenther
Date April 3, 2013, 10:24 a.m.
Message ID <alpine.LNX.2.00.1304031223590.21094@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/233342/
State New
Headers show

Comments

Richard Guenther - April 3, 2013, 10:24 a.m.
The testcase no longer fails on the 4.8 branch and trunk,
committed there so we do not regress.

Richard.

2013-04-03  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/56407
	* gcc.dg/torture/pr56407.c: New testcase.

Patch

Index: gcc/testsuite/gcc.dg/torture/pr56407.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pr56407.c	(revision 0)
+++ gcc/testsuite/gcc.dg/torture/pr56407.c	(working copy)
@@ -0,0 +1,48 @@ 
+/* { dg-do run } */
+
+extern void abort(void);
+extern int rand(void);
+
+static void copy(int *r,int *a,int na)
+{
+  int i;
+  for( i = 0 ; i < na ; i++ )
+    r[i] = a[i];
+}
+
+static void foo(int *a,int na)
+{
+  int i;
+  for( i = 0 ; i < na ; i++ )
+    a[i] = rand();
+}
+
+static int cmp(int *a,int *b,int n)
+{
+  int i;
+  for( i = 0 ; i < n ; i++ )
+    if ( a[i] != b[i] )
+      return -1;
+  return 0;
+}
+
+void __attribute__((noinline,noclone))
+test(int sz,int comm)
+{
+  int j,n;
+  int v[64],w[64];
+  for( j = 1 ; j <= sz ; j++ )
+    {
+      n = (2 * j - 1) * (2 * j - 1);
+      foo(w,n);
+      copy(v,w,n);
+      if ( comm )
+	if ( cmp(v,w,n) ) abort ();
+    }
+}
+
+int main()
+{
+  test(2,1);
+  return 0;
+}