1 /* PR optimization/10955 */
2 /* Originator: <heinrich.brand@fujitsu-siemens.com> */
3 
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.  */
7 
8 extern void abort(void);
9 
10 #define COMPLEX struct CS
11 
12 COMPLEX {
13   long x;
14   long y;
15 };
16 
17 
CCID(COMPLEX x)18 static COMPLEX CCID (COMPLEX x)
19 {
20   COMPLEX a;
21 
22   a.x = x.x;
23   a.y = x.y;
24 
25   return a;
26 }
27 
28 
CPOW(COMPLEX x,int y)29 static COMPLEX CPOW (COMPLEX x, int y)
30 {
31   COMPLEX a;
32   a = x;
33 
34   while (--y > 0)
35     a=CCID(a);
36 
37   return a;
38 }
39 
40 
c5p(COMPLEX x)41 static int c5p (COMPLEX x)
42 {
43   COMPLEX a,b;
44   a = CPOW (x, 2);
45   b = CCID( CPOW(a,2) );
46 
47   return (b.x == b.y);
48 }
49 
50 
main(void)51 int main (void)
52 {
53   COMPLEX  x;
54 
55   x.x = -7;
56   x.y = -7;
57 
58   if (!c5p(x))
59     abort();
60 
61   return 0;
62 }
63