blob: 6b8aadfe15e691e1c52eb28f1803d1ebb0782a04 [file] [log] [blame]
Peter Collingbourne49d29ed2013-10-20 21:29:32 +00001// 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 Smith0a7062f2012-11-29 23:03:58 +00005
6#ifdef __SIZEOF_INT128__
7typedef __int128 intmax;
8#else
9typedef long long intmax;
10#endif
Richard Smith6ebe4512012-10-09 19:34:32 +000011
12int main() {
Will Dietz7cbd7e52012-12-02 18:43:33 +000013 // CHECK: div-zero.cpp:[[@LINE+1]]:12: runtime error: division by zero
Richard Smith6ebe4512012-10-09 19:34:32 +000014 DIVIDEND / 0;
15}