* gcc.target/i386/mpx/hard-reg-1-nov.c (mpx_test): Use "esp"
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20030717-1.c
blob7e43e44be041b315d1de020b6abb970290101bcd
1 /* PR target/11087
2 This testcase was miscompiled on ppc64, because basic_induction_var called
3 convert_modes, yet did not expect it to emit any new instructions.
4 Those were emitted at the end of the function and destroyed during life
5 analysis, while the program used uninitialized pseudos created by
6 convert_modes. */
8 struct A
10 unsigned short a1;
11 unsigned long a2;
14 struct B
16 int b1, b2, b3, b4, b5;
19 struct C
21 struct B c1[1];
22 int c2, c3;
25 static
26 int foo (int x)
28 return x < 0 ? -x : x;
31 int bar (struct C *x, struct A *y)
33 int a = x->c3;
34 const int b = y->a1 >> 9;
35 const unsigned long c = y->a2;
36 int d = a;
37 unsigned long e, f;
39 f = foo (c - x->c1[d].b4);
42 if (d <= 0)
43 d = x->c2;
44 d--;
46 e = foo (c-x->c1[d].b4);
47 if (e < f)
48 a = d;
50 while (d != x->c3);
51 x->c1[a].b4 = c + b;
52 return a;
55 int
56 main ()
58 struct A a;
59 struct C b;
60 int c;
62 a.a1 = 512;
63 a.a2 = 4242;
64 __builtin_memset (&b, 0, sizeof (b));
65 b.c1[0].b3 = 424242;
66 b.c2 = 1;
67 c = bar (&b, &a);
68 return 0;