PR c++/82069 - ICE with lambda in template
[official-gcc.git] / gcc / testsuite / gcc.dg / 20050922-1.c
blob982f82011ba5f3f441539f5db53e74a6a8302d63
1 /* This revealed a bug when rotates are expanded into
2 two shifts. */
4 /* { dg-do run } */
5 /* { dg-options "-O1 -std=c99" } */
7 extern void abort (void);
9 #if __INT_MAX__ == 2147483647
10 typedef unsigned int uint32_t;
11 #elif __LONG_MAX__ == 2147483647
12 typedef unsigned long uint32_t;
13 #else
14 #error unable to find 32-bit integer type
15 #endif
17 uint32_t
18 f (uint32_t *S, int j)
20 uint32_t A, B, k, L[2] = {1234, 5678};
21 int i, m;
23 A = B = 0;
24 for (i = 0; i < j; i++)
26 k = (S[i] + A + B) & 0xffffffffL;
27 A = S[i] =
28 ((k << (3 & 0x1f)) | ((k & 0xffffffff) >> (32 - (3 & 0x1f))));
30 m = (int) (A + B);
31 k = (L[i] + A + B) & 0xffffffffL;
32 B = L[i] =
33 ((k << (m & 0x1f)) | ((k & 0xffffffff) >> (32 - (m & 0x1f))));
35 return L[0] + L[1];
38 int
39 main ()
41 uint32_t S[2] = {0xffff, 0xffffff};
43 if (f (S,2)!= 1392607300)
44 abort();
46 return 0;