gcc/testsuite/gcc.dg/ubsan/builtin-stdc-rotate-2.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options "-fsanitize=shift -fno-sanitize-recover=shift -std=c2y" } */ |
| 3 | |
| 4 | int |
| 5 | main () |
| 6 | { |
| 7 | int a = sizeof (unsigned) * __CHAR_BIT__ + 1; |
| 8 | unsigned b = 42; |
| 9 | unsigned c = __builtin_stdc_rotate_left (b, a); |
| 10 | unsigned d = __builtin_stdc_rotate_right (b, a); |
| 11 | volatile int e = c + d; |
| 12 | if (c != 84 || d != 21) |
| 13 | __builtin_abort (); |
| 14 | } |