about summary refs log tree commit diff homepage
path: root/test/Feature/ubsan_umul_overflow.c
blob: 2525a5e058da6f509833fe6ca9e15772e82a2a28 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// 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 multiplication" %t.log
// RUN: grep -c "ubsan_umul_overflow.c:18: overflow" %t.log
// RUN: grep -c "ubsan_umul_overflow.c:19: overflow" %t.log

#include "klee/klee.h"

int main()
{
  unsigned int x;
  unsigned int y;
  uint32_t x2=3147483648, y2=3727483648;
  volatile unsigned int result;

  klee_make_symbolic(&x, sizeof(x), "unsigned mul 1");
  klee_make_symbolic(&y, sizeof(y), "unsigned mul 2");
  result = x * y;
  result = x2 * y2;

  return 0;
}