blob: cd2295c5c6d6885e78c60ab1694809c639dcbb59 (
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
|
// RUN: %clang %s -emit-llvm -g %O0opt -c -o %t.bc
// RUN: rm -rf %t.klee-out
// RUN: %klee --output-dir=%t.klee-out -check-overshift %t.bc 2> %t.log
// RUN: FileCheck --input-file %t.log %s
/* This test checks that two consecutive potential overshifts
* are reported as errors.
*/
#include "klee/klee.h"
int main() {
unsigned int x = 15;
unsigned int y;
unsigned int z;
volatile unsigned int result;
/* Overshift if y>= sizeof(x) */
klee_make_symbolic(&y, sizeof(y), "shift_amount1");
// CHECK: OvershiftCheck.c:[[@LINE+1]]: overshift error
result = x << y;
/* Overshift is z>= sizeof(x) */
klee_make_symbolic(&z, sizeof(z), "shift_amount2");
// CHECK: OvershiftCheck.c:[[@LINE+1]]: overshift error
result = x >> z;
return 0;
}
|