summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/ubsan/lit_tests/Integer/div-zero.cpp
blob: b9aed51232f4992022771101cc178eae60de7ef4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// RUN: %clang -fsanitize=integer-divide-by-zero -DDIVIDEND=0 %s -o %t && %t 2>&1 | FileCheck %s
// RUN: %clang -fsanitize=integer-divide-by-zero -DDIVIDEND=1U %s -o %t && %t 2>&1 | FileCheck %s
// RUN: %clang -fsanitize=float-divide-by-zero -DDIVIDEND=1.5 %s -o %t && %t 2>&1 | FileCheck %s
// RUN: %clang -fsanitize=integer-divide-by-zero -DDIVIDEND='intmax(123)' %s -o %t && %t 2>&1 | FileCheck %s

#ifdef __SIZEOF_INT128__
typedef __int128 intmax;
#else
typedef long long intmax;
#endif

int main() {
  // CHECK: div-zero.cpp:[[@LINE+1]]:12: fatal error: division by zero
  DIVIDEND / 0;
}
OpenPOWER on IntegriCloud