Peter Collingbourne | 49d29ed | 2013-10-20 21:29:32 +0000 | [diff] [blame^] | 1 | // RUN: %clangxx -fsanitize=integer-divide-by-zero -DDIVIDEND=0 %s -o %t && %t 2>&1 | FileCheck %s |
| 2 | // RUN: %clangxx -fsanitize=integer-divide-by-zero -DDIVIDEND=1U %s -o %t && %t 2>&1 | FileCheck %s |
| 3 | // RUN: %clangxx -fsanitize=float-divide-by-zero -DDIVIDEND=1.5 %s -o %t && %t 2>&1 | FileCheck %s |
| 4 | // RUN: %clangxx -fsanitize=integer-divide-by-zero -DDIVIDEND='intmax(123)' %s -o %t && %t 2>&1 | FileCheck %s |
Richard Smith | 0a7062f | 2012-11-29 23:03:58 +0000 | [diff] [blame] | 5 | |
| 6 | #ifdef __SIZEOF_INT128__ |
| 7 | typedef __int128 intmax; |
| 8 | #else |
| 9 | typedef long long intmax; |
| 10 | #endif |
Richard Smith | 6ebe451 | 2012-10-09 19:34:32 +0000 | [diff] [blame] | 11 | |
| 12 | int main() { |
Will Dietz | 7cbd7e5 | 2012-12-02 18:43:33 +0000 | [diff] [blame] | 13 | // CHECK: div-zero.cpp:[[@LINE+1]]:12: runtime error: division by zero |
Richard Smith | 6ebe451 | 2012-10-09 19:34:32 +0000 | [diff] [blame] | 14 | DIVIDEND / 0; |
| 15 | } |