Patchwork Testcase for PR55964 from PR56097

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

Comments

Richard Guenther - April 3, 2013, 10:36 a.m.
Slightly different and less arcane.

Tested on x86_64-unknown-linux-gnu, applied to trunk and branch.

Richard.

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

	PR tree-optimization/55964
	* gcc.dg/torture/pr55964-2.c: New testcase.

Patch

Index: gcc/testsuite/gcc.dg/torture/pr55964-2.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pr55964-2.c	(revision 0)
+++ gcc/testsuite/gcc.dg/torture/pr55964-2.c	(working copy)
@@ -0,0 +1,21 @@ 
+/* { dg-do compile } */
+/* { dg-options "-ftree-loop-distribution -funswitch-loops" } */
+
+struct test_struct {
+    int a, b[10], c[10], d[10];
+};
+
+extern struct test_struct* new_struct;
+
+void testfunc(struct test_struct* old_struct)
+{
+  int i;
+  for (i = 0; i < 10; ++i)
+    {
+      new_struct->b[i] = old_struct ? old_struct->b[i] : -1;
+      new_struct->c[i] = old_struct ? old_struct->c[i] : 0;
+      new_struct->d[i] = old_struct ? old_struct->d[i] : 0;
+    }
+  if (old_struct)
+    old_struct->a++;
+}