about summary refs log tree commit diff homepage
path: root/test/regression/2014-12-08-ashr.c
blob: ec7050d77db8b68bad983dea5fbc9a4a62c97983 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// RUN: %clang %s -emit-llvm -g %O0opt -c -o %t.bc
// RUN: rm -rf %t.klee-out
// RUN: %klee --output-dir=%t.klee-out -exit-on-error %t.bc

#include <assert.h>
#include <klee/klee.h>

int f1(int a, int b) {
  return a + b;
}

int f2(int a, int b) {
  int i;
  for (i = 0; i < sizeof(b) * 8; i++)
    a += (((b >> i) & 1) << i);

  return a;
}

int main(int argc, char **argv) {
  int a, b;
  klee_make_symbolic(&a, sizeof(a), "a");
  klee_make_symbolic(&b, sizeof(b), "b");

  klee_assert(f1(a, b) == f2(a, b));

  return 0;
}