aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2013-04-03 10:25:23 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2013-04-03 10:25:23 +0000
commit6b94a92dc974cea523a2a4025f66882696259b97 (patch)
tree88f5115e03eba7f5ad563c5a6a814945b77eef38
parentec9202a88724837804855031a0360232aebb981b (diff)
downloadgcc-6b94a92dc974cea523a2a4025f66882696259b97.zip
gcc-6b94a92dc974cea523a2a4025f66882696259b97.tar.gz
gcc-6b94a92dc974cea523a2a4025f66882696259b97.tar.bz2
re PR tree-optimization/56407 (Optimizations (-O2 -O3) make comparison of arrays of ints to fail)
2013-04-03 Richard Biener <rguenther@suse.de> PR tree-optimization/56407 * gcc.dg/torture/pr56407.c: New testcase. From-SVN: r197399
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr56407.c48
2 files changed, 53 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b147235..5b2ae95 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2013-04-03 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/56407
+ * gcc.dg/torture/pr56407.c: New testcase.
+
2013-04-03 Marc Glisse <marc.glisse@inria.fr>
PR tree-optimization/56790
diff --git a/gcc/testsuite/gcc.dg/torture/pr56407.c b/gcc/testsuite/gcc.dg/torture/pr56407.c
new file mode 100644
index 0000000..f26fd23
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr56407.c
@@ -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;
+}