This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Add a testcase for PR 15084
- From: Jakub Jelinek <jakub at redhat dot com>
- To: "H. J. Lu" <hjl at lucon dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 10 May 2004 12:14:44 -0400
- Subject: Re: PATCH: Add a testcase for PR 15084
- References: <20040507221049.GA27436@lucon.org>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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