gcc/testsuite/gcc.dg/ubsan/c99-shift-4.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options "-fsanitize=shift-exponent -fno-sanitize=shift-base -w -std=c99" } */ |
| 3 | |
| 4 | int |
| 5 | main (void) |
| 6 | { |
| 7 | int a = -42; |
| 8 | int b = -43; |
| 9 | volatile int c = 129; |
| 10 | int d = 1; |
| 11 | b << c; |
| 12 | a << 1; |
| 13 | a << 1; |
| 14 | d <<= 31; |
| 15 | b << (c + 1); |
| 16 | } |
| 17 | /* { dg-output "shift exponent 129 is too large for \[^\n\r]*-bit type 'int'\[^\n\r]*(\n|\r\n|\r)" } */ |
| 18 | /* { dg-output "\[^\n\r]*shift exponent 130 is too large for \[^\n\r]*-bit type 'int'" } */ |