about summary refs log tree commit diff homepage
path: root/test/Feature/AddressOfLabelsSymbolic.c
blob: 1097a189bc33fb4c8494f6746caa1a0aa384f017 (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
30
31
32
33
34
35
36
37
38
39
40
// RUN: %clang -emit-llvm -g -c %s -o %t.bc
// RUN: rm -rf %t.klee-out
// RUN: %klee --output-dir=%t.klee-out %t.bc > %t.log 2> %t.stderr.log
// RUN: FileCheck %s -check-prefix=CHECK-MSG --input-file=%t.log
// RUN: FileCheck %s -check-prefix=CHECK-ERR --input-file=%t.stderr.log

#include "klee/klee.h"

#include <stdio.h>

int main(void) {
	void * lptr = &&one;
	lptr = &&two;
	lptr = &&three;

	klee_make_symbolic(&lptr, sizeof(lptr), "lptr");
// CHECK-ERR: KLEE: ERROR: {{.*}} indirectbr: illegal label address
	goto *lptr;

one:
	puts("Label one");
// CHECK-MSG-DAG: Label one
	return 0;

two:
	puts("Label two");
// CHECK-MSG-DAG: Label two
	return 0;

three:
	puts("Label three");
// CHECK-MSG-DAG: Label three
	return 0;

// LLVM should infer only {one, two, three} as valid targets
four:
	puts("Label four");
// CHECK-MSG-NOT: Label four
	return 0;
}