gcc/testsuite/c-c++-common/ubsan/pr58443-3.c
raw| 1 | /* PR sanitizer/58443 */ |
| 2 | /* { dg-do compile } */ |
| 3 | /* { dg-options "-fsanitize=undefined -w" } */ |
| 4 | |
| 5 | int |
| 6 | foo (int u, int o) |
| 7 | { |
| 8 | return u >> o; |
| 9 | } |
| 10 | |
| 11 | int |
| 12 | bar (int u, int o) |
| 13 | { |
| 14 | return u / o; |
| 15 | } |
| 16 | |
| 17 | /* { dg-final { scan-assembler "__ubsan_handle_divrem_overflow" } } */ |
| 18 | /* { dg-final { scan-assembler "__ubsan_handle_shift_out_of_bounds" } } */ |