about summary refs log tree commit diff homepage
path: root/test/Feature/ubsan/ubsan_float_divide_by_zero.c
blob: 4c68eb75df06633fd143323e470e2f46698af927 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// RUN: %clang %s -fsanitize=float-divide-by-zero -emit-llvm -g %O0opt -c -o %t.bc
// RUN: rm -rf %t.klee-out
// RUN: %klee --output-dir=%t.klee-out --emit-all-errors --ubsan-runtime %t.bc 2>&1 | FileCheck %s
// RUN: ls %t.klee-out/ | grep .ktest | wc -l | grep 1
// RUN: ls %t.klee-out/ | grep .div.err | wc -l | grep 1

#include "klee/klee.h"

int main() {
  float x = 1.0;

  // TODO: uncomment when support for floating points is integrated

  //  klee_make_symbolic(&x, sizeof(x), "x");
  //  klee_assume(x != 0.0);

  // CHECK: KLEE: ERROR: {{.*}}runtime/Sanitizer/ubsan/ubsan_handlers.cpp:{{[0-9]+}}: float-divide-by-zero
  volatile float result = x / 0;
}