Debian Codegraph @

gcc/testsuite/gcc.dg/20050922-2.c

raw
1 /* 20050922-1.c does not trigger the expand_shift rotate bug on sh4-elf, but
2 this does. */
3
4 /* { dg-do run } */
5 /* { dg-options "-O1 -std=c99" } */
6
7 extern void abort (void);
8 extern void exit (int);
9
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
17
18 #define rotl(x,n) (((x) << ((int)(n))) | ((x) >> (32 - (int)(n))))
19
20 uint32_t
21 f (uint32_t a, uint32_t b)
22 {
23
24 b = rotl (a, b & 31);
25 return b;
26 }
27
28 int
29 main ()
30 {
31 if (f(2,31) != 1)
32 abort ();
33 exit (0);
34 }