gcc/testsuite/gcc.c-torture/compile/pr93505.c
raw| 1 | /* PR middle-end/93505 */ |
| 2 | |
| 3 | unsigned a; |
| 4 | |
| 5 | unsigned |
| 6 | foo (unsigned x) |
| 7 | { |
| 8 | unsigned int y = 32 - __builtin_bswap64 (-a); |
| 9 | /* This would be UB (x << 32) at runtime. Ensure we don't |
| 10 | invoke UB in the compiler because of that (visible with |
| 11 | bootstrap-ubsan). */ |
| 12 | x = x << y | x >> (-y & 31); |
| 13 | x >>= 31; |
| 14 | return x; |
| 15 | } |