aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/cast-weirds.c
blob: a99c65d25d9b9489e31a296fe84d81af86c94fd7 (plain)
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
41
42
43
44
45
46
47
48
49
50
51
typedef unsigned int uint;
typedef unsigned long ulong;

static int * int_2_iptr(int a) { return (int *)a; }
static int * uint_2_iptr(uint a) { return (int *)a; }

static void * int_2_vptr(int a) { return (void *)a; }
static void * uint_2_vptr(uint a) { return (void *)a; }

/*
 * check-name: cast-weirds
 * check-command: test-linearize -m64 $file
 *
 * check-error-start
cast-weirds.c:4:42: warning: non size-preserving integer to pointer cast
cast-weirds.c:5:44: warning: non size-preserving integer to pointer cast
 * check-error-end
 *
 * check-output-start
int_2_iptr:
.L0:
	<entry-point>
	sext.64     %r2 <- (32) %arg1
	utptr.64    %r3 <- (64) %r2
	ret.64      %r3


uint_2_iptr:
.L2:
	<entry-point>
	zext.64     %r6 <- (32) %arg1
	utptr.64    %r7 <- (64) %r6
	ret.64      %r7


int_2_vptr:
.L4:
	<entry-point>
	sext.64     %r10 <- (32) %arg1
	ret.64      %r10


uint_2_vptr:
.L6:
	<entry-point>
	zext.64     %r13 <- (32) %arg1
	ret.64      %r13


 * check-output-end
 */