Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gcc.target / i386 / pr36613.c
blobe9d7d11cedc854f88459a9108a371f1fd2abc4ee
1 /* { dg-do run { target { { i?86-*-linux* x86_64-*-linux* } && ilp32 } } } */
2 /* { dg-options "-Os" } */
3 /* PR target/36613 */
5 extern void abort (void);
7 static inline int
8 lshifts (int val, int cnt)
10 if (val < 0)
11 return val;
12 return val << cnt;
15 static inline unsigned int
16 lshiftu (unsigned int val, unsigned int cnt)
18 if (cnt >= sizeof (unsigned int) * __CHAR_BIT__
19 || val > ((__INT_MAX__ * 2U) >> cnt))
20 return val;
21 return val << cnt;
24 static inline int
25 rshifts (int val, unsigned int cnt)
27 if (val < 0 || cnt >= sizeof (int) * __CHAR_BIT__)
28 return val;
29 return val >> cnt;
32 int
33 foo (unsigned int val)
35 return rshifts (1 + val, lshifts (lshiftu (val, val), 1));
38 int
39 main (void)
41 if (foo (1) != 0)
42 abort ();
43 return 0;