about summary refs log tree commit diff homepage
path: root/test/Feature/ubsan_usub_overflow.c
blob: bfd94e3c53672b2a348d290fced887641368735c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// RUN: %llvmgcc %s -fsanitize=unsigned-integer-overflow -emit-llvm -g -O0 -c -o %t.bc
// RUN: %klee %t.bc 2> %t.log
// RUN: grep -c "overflow on unsigned subtraction" %t.log
// RUN: grep -c "ubsan_usub_overflow.c:16: overflow" %t.log

#include "klee/klee.h"

int main()
{
  unsigned int x;
  unsigned int y;
  volatile unsigned int result;

  klee_make_symbolic(&x, sizeof(x), "unsigned sub 1");
  klee_make_symbolic(&y, sizeof(y), "unsigned sub 2");
  result = x - y;

  return 0;
}