2014-07-29 Ed Smith-Rowland <3dw4rd@verizon.net>
[official-gcc.git] / gcc / testsuite / gcc.dg / 20050922-2.c
blob2e8db829e297746c5917b7e8d9fcf6e28c598fab
1 /* 20050922-1.c does not trigger the expand_shift rotate bug on sh4-elf, but
2 this does. */
4 /* { dg-do run } */
5 /* { dg-options "-O1 -std=c99" } */
7 extern void abort (void);
8 extern void exit (int);
10 #if __INT_MAX__ == 2147483647
11 typedef unsigned int uint32_t;
12 #elif __LONG_MAX__ == 2147483647
13 typedef unsigned long uint32_t;
14 #else
15 #error unable to find 32-bit integer type
16 #endif
18 #define rotl(x,n) (((x) << ((int)(n))) | ((x) >> (32 - (int)(n))))
20 uint32_t
21 f (uint32_t a, uint32_t b)
24 b = rotl (a, b & 31);
25 return b;
28 int
29 main ()
31 if (f(2,31) != 1)
32 abort ();
33 exit (0);