2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20030613-1.c
blobcb1623d9617ad2c213ffbd63b6cadee20bb846b7
1 /* PR optimization/10955 */
2 /* Originator: <heinrich.brand@fujitsu-siemens.com> */
4 /* This used to fail on SPARC32 at -O3 because the loop unroller
5 wrongly thought it could eliminate a pseudo in a loop, while
6 the pseudo was used outside the loop. */
8 extern void abort(void);
10 #define COMPLEX struct CS
12 COMPLEX {
13 long x;
14 long y;
18 static COMPLEX CCID (COMPLEX x)
20 COMPLEX a;
22 a.x = x.x;
23 a.y = x.y;
25 return a;
29 static COMPLEX CPOW (COMPLEX x, int y)
31 COMPLEX a;
32 a = x;
34 while (--y > 0)
35 a=CCID(a);
37 return a;
41 static int c5p (COMPLEX x)
43 COMPLEX a,b;
44 a = CPOW (x, 2);
45 b = CCID( CPOW(a,2) );
47 return (b.x == b.y);
51 int main (void)
53 COMPLEX x;
55 x.x = -7;
56 x.y = -7;
58 if (!c5p(x))
59 abort();
61 return 0;