| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-fsanitize=bounds -Wall -Wextra" } */ |
| 3 |
|
| 4 |
/* Do not generate invalid diagnostics. */ |
| 5 |
|
| 6 |
extern const int a[10]; |
| 7 |
extern int bar (int); |
| 8 |
void |
| 9 |
foo (int i, int j) |
| 10 |
{ |
| 11 |
bar (a[i] >> j); |
| 12 |
bar ((unsigned long) a[i] >> j); |
| 13 |
bar ((short int) (unsigned long) a[i] >> j); |
| 14 |
bar (j >> a[i]); |
| 15 |
bar (j >> (unsigned long) a[i]); |
| 16 |
bar (j >> (short int) (unsigned long) a[i]); |
| 17 |
bar (a[i] / j); |
| 18 |
bar ((unsigned long) a[i] / j); |
| 19 |
bar ((short int) (unsigned long) a[i] / j); |
| 20 |
bar (j / a[i]); |
| 21 |
bar (j / (unsigned long) a[i]); |
| 22 |
bar (j / (short int) (unsigned long) a[i]); |
| 23 |
} |