This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Add a testcase for PR 15084


On Fri, May 07, 2004 at 03:10:49PM -0700, H. J. Lu wrote:
> Should I rename it to 15084-1.c and enable it for all targets?

Well, IMHO:
a) it belongs to gcc.c-torture/execute, so that it is tested on all targets
   and at all optimization options
b) there is no need to include target headers
c) if possible tests should follow GCC indentation

So more like:

	PR target/15084
	* gcc.c-torture/execute/20040510-1.c: New test.

--- gcc/testsuite/gcc.c-torture/execute/20040510-1.c.jj	2004-01-21 17:12:41.000000000 +0100
+++ gcc/testsuite/gcc.c-torture/execute/20040510-1.c	2004-05-10 18:05:30.464140898 +0200
@@ -0,0 +1,45 @@
+/* PR target/15084 */
+extern void abort (void);
+extern void exit (int);
+
+struct A
+{
+  unsigned char a, b;
+  unsigned short c;
+  unsigned char d, e, f, g;
+};
+
+struct A h[255];
+int j = 0;
+
+void
+foo (void)
+{
+  struct A a;
+  int i = 0;
+
+  a.f = 10;
+  for (i = 0; i < 16; i++)
+    {
+      int idx;
+      for (idx = 0; idx < j; idx++)
+	if (h[idx].d == 0 && (h[idx].e == i || h[idx].g == i))
+	  break;
+
+      if (idx != j)
+	continue;
+      a.b = 0;
+      a.e = i;
+      a.g = i;
+      h[j++] = a;
+    }
+}
+
+int
+main ()
+{
+  foo ();
+  if (h[0].f != 10)
+    abort ();
+  exit (0);
+}

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]