| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-fsanitize=shift-base -fno-sanitize=shift-exponent -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 |
a << 1; |
| 12 |
b << c; |
| 13 |
a << 1; |
| 14 |
d <<= 31; |
| 15 |
} |
| 16 |
/* { dg-output "left shift of negative value -42\[^\n\r]*(\n|\r\n|\r)" } */ |
| 17 |
/* { dg-output "\[^\n\r]*left shift of negative value -42\[^\n\r]*(\n|\r\n|\r)" } */ |
| 18 |
/* { dg-output "\[^\n\r]*left shift of 1 by 31 places cannot be represented in type 'int'" } */ |