about summary refs log tree commit diff homepage
path: root/test/Feature/AddressOfLabels.c
blob: 6d807dbb39a172f6f55ac5cbef5f2bca11258be3 (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
// RUN: %llvmgcc -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
// RUN: FileCheck --input-file=%t.log %s

#include <stdio.h>

int main(int argc, char * argv[]) {
	// prevent CFGSimplificationPass optimisation
	void * dummy = &&one;
	switch(argc) {
		case 1: break;
		case 2:
			dummy = &&three;
			goto *dummy;
		default:
			goto *dummy;
	}

	// the real test
	void * lptr = &&two;
	goto *lptr;

one:
	puts("Label one");
// CHECK-NOT: Label one
	return 1;

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

three:
	puts("Label three");
// CHECK-NOT: Label three
	return 1;
}