Pirama Arumuga Nainar | cdce50b | 2015-07-01 12:26:56 -0700 | [diff] [blame] | 1 | // RUN: %clangxx -fsanitize=integer -fsanitize-recover=integer %s -o %t |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 2 | // RUN: not %run %t 2>&1 | FileCheck %s |
Pirama Arumuga Nainar | cdce50b | 2015-07-01 12:26:56 -0700 | [diff] [blame] | 3 | |
| 4 | // __ubsan_default_options() doesn't work on Darwin. |
| 5 | // XFAIL: darwin |
| 6 | |
| 7 | #include <stdint.h> |
| 8 | |
| 9 | extern "C" const char *__ubsan_default_options() { |
| 10 | return "halt_on_error=1"; |
| 11 | } |
| 12 | |
| 13 | int main() { |
| 14 | (void)(uint64_t(10000000000000000000ull) + uint64_t(9000000000000000000ull)); |
| 15 | // CHECK: ubsan_options.cc:[[@LINE-1]]:44: runtime error: unsigned integer overflow |
| 16 | return 0; |
| 17 | } |
| 18 | |