| 1 |
/* PR sanitizer/58411 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-fsanitize=undefined -w" } */ |
| 4 |
|
| 5 |
__attribute__((no_sanitize_undefined)) int |
| 6 |
f1 (int i) |
| 7 |
{ |
| 8 |
return 16 << i; |
| 9 |
} |
| 10 |
|
| 11 |
int f2 (int i); |
| 12 |
int f2 (int i) __attribute__((no_sanitize_undefined)); |
| 13 |
int f2 (int i) __attribute__((no_sanitize_undefined)); |
| 14 |
int f2 (int i); |
| 15 |
|
| 16 |
int |
| 17 |
f2 (int i) |
| 18 |
{ |
| 19 |
return 1 / i; |
| 20 |
} |
| 21 |
|
| 22 |
void f3 (void); |
| 23 |
__typeof (f3) f3 __attribute__((__no_sanitize_undefined__)); |
| 24 |
|
| 25 |
void |
| 26 |
f3 (void) |
| 27 |
{ |
| 28 |
__builtin_unreachable (); |
| 29 |
} |
| 30 |
|
| 31 |
/* { dg-final { scan-assembler-not "__ubsan_handle_shift_out_of_bounds" } } */ |
| 32 |
/* { dg-final { scan-assembler-not "__ubsan_handle_divrem_overflow" } } */ |
| 33 |
/* { dg-final { scan-assembler-not "__ubsan_handle_builtin_unreachable" } } */ |