| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-fsanitize=undefined -fsanitize=shift -fsanitize=float-divide-by-zero -fdump-tree-optimized" } */ |
| 3 |
/* { dg-skip-if "" { *-*-* } { "-flto -fno-fat-lto-objects" } } */ |
| 4 |
/* { dg-final { scan-tree-dump-times "__ubsan_handle_divrem_overflow" 2 "optimized" } } */ |
| 5 |
/* { dg-final { scan-tree-dump-times "__ubsan_handle_shift_out_of_bounds" 1 "optimized" } } */ |
| 6 |
|
| 7 |
int |
| 8 |
foo (int x, int y) |
| 9 |
{ |
| 10 |
return x / y; |
| 11 |
} |
| 12 |
|
| 13 |
int |
| 14 |
bar (int x, int y) |
| 15 |
{ |
| 16 |
return x << y; |
| 17 |
} |
| 18 |
|
| 19 |
float |
| 20 |
baz (float x, float y) |
| 21 |
{ |
| 22 |
return x / y; |
| 23 |
} |