gcc/testsuite/gcc.dg/ubsan/builtin-stdc-rotate-1.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options "-fsanitize=shift -std=c2y" } */ |
| 3 | |
| 4 | int |
| 5 | main () |
| 6 | { |
| 7 | int a = -42; |
| 8 | unsigned b = 42; |
| 9 | unsigned c = __builtin_stdc_rotate_left (b, a); |
| 10 | unsigned d = __builtin_stdc_rotate_right (b, a - 1); |
| 11 | volatile int e = c + d; |
| 12 | } |
| 13 | /* { dg-output "shift exponent -42 is negative\[^\n\r]*(\n|\r\n|\r)" } */ |
| 14 | /* { dg-output "\[^\n\r]*shift exponent -43 is negative" } */ |