File tree 16 files changed +401
-38
lines changed
16 files changed +401
-38
lines changed Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+ #include <assert.h>
3
+
4
+ struct A {
5
+ int x ;
6
+ };
7
+
8
+ int main (int argc , char * * argv ) {
9
+
10
+ struct A a ;
11
+ int i ;
12
+ struct A * a_addr = & a ;
13
+
14
+ if (argc != 2 )
15
+ return ;
16
+
17
+ void * * ptrs [argc ];
18
+ for (i = 0 ; i < 2 ; ++ i )
19
+ ptrs [i ] = (void * )0 ;
20
+
21
+ ((struct A * * )ptrs )[1 ]= & a ;
22
+ assert (ptrs [1 ] == (void * )& a );
23
+
24
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+ #include <assert.h>
3
+
4
+ int main (int argc , char * * argv ) {
5
+
6
+ if (argc != 2 )
7
+ return 0 ;
8
+
9
+ unsigned long x [argc ];
10
+ x [0 ]= 0x0102030405060708 ;
11
+ x [1 ]= 0x1112131415161718 ;
12
+
13
+ unsigned char * alias = (unsigned short * )(((char * )x )+ 5 );
14
+ * alias = 0xed ;
15
+
16
+ unsigned char * alias2 = (unsigned char * )x ;
17
+ /*
18
+ for(int i = 0; i < 16; ++i)
19
+ printf("%02hhx\n",alias2[i]);
20
+ */
21
+
22
+ assert (alias2 [0 ]== 0x08 );
23
+ assert (alias2 [1 ]== 0x07 );
24
+ assert (alias2 [2 ]== 0x06 );
25
+ assert (alias2 [3 ]== 0x05 );
26
+ assert (alias2 [4 ]== 0x04 );
27
+ assert (alias2 [5 ]== 0xed );
28
+ assert (alias2 [6 ]== 0x02 );
29
+ assert (alias2 [7 ]== 0x01 );
30
+ assert (alias2 [8 ]== 0x18 );
31
+ assert (alias2 [9 ]== 0x17 );
32
+ assert (alias2 [10 ]== 0x16 );
33
+ assert (alias2 [11 ]== 0x15 );
34
+ assert (alias2 [12 ]== 0x14 );
35
+ assert (alias2 [13 ]== 0x13 );
36
+ assert (alias2 [14 ]== 0x12 );
37
+ assert (alias2 [15 ]== 0x11 );
38
+
39
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+ #include <assert.h>
3
+
4
+ int main (int argc , char * * argv ) {
5
+
6
+ if (argc != 5 )
7
+ return 0 ;
8
+
9
+ short x [argc ];
10
+ x [0 ]= 0x0102 ;
11
+ x [1 ]= 0x0304 ;
12
+ x [2 ]= 0x0506 ;
13
+ x [3 ]= 0x0708 ;
14
+ x [4 ]= 0x090a ;
15
+
16
+ unsigned long * alias = (unsigned long * )(((char * )x )+ 0 );
17
+ * alias = 0xf1f2f3f4f5f6f7f8 ;
18
+
19
+ unsigned char * alias2 = (unsigned char * )x ;
20
+ assert (alias2 [0 ]== 0xf8 );
21
+ assert (alias2 [1 ]== 0xf7 );
22
+ assert (alias2 [2 ]== 0xf6 );
23
+ assert (alias2 [3 ]== 0xf5 );
24
+ assert (alias2 [4 ]== 0xf4 );
25
+ assert (alias2 [5 ]== 0xf3 );
26
+ assert (alias2 [6 ]== 0xf2 );
27
+ assert (alias2 [7 ]== 0xf1 );
28
+ assert (alias2 [8 ]== 0x0a );
29
+ assert (alias2 [9 ]== 0x09 );
30
+
31
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+ #include <assert.h>
3
+
4
+ int main (int argc , char * * argv ) {
5
+
6
+ if (argc != 10 )
7
+ return 0 ;
8
+
9
+ unsigned char x [argc ];
10
+ x [0 ]= 0x01 ;
11
+ x [1 ]= 0x02 ;
12
+ x [2 ]= 0x03 ;
13
+ x [3 ]= 0x04 ;
14
+ x [4 ]= 0x05 ;
15
+ x [5 ]= 0x06 ;
16
+ x [6 ]= 0x07 ;
17
+ x [7 ]= 0x08 ;
18
+ x [8 ]= 0x09 ;
19
+ x [9 ]= 0x0a ;
20
+
21
+ unsigned long * alias = (unsigned long * )(((char * )x )+ 1 );
22
+ * alias = 0xf1f2f3f4f5f6f7f8 ;
23
+
24
+ unsigned char * alias2 = (unsigned char * )x ;
25
+ assert (alias2 [0 ]== 0x01 );
26
+ assert (alias2 [1 ]== 0xf8 );
27
+ assert (alias2 [2 ]== 0xf7 );
28
+ assert (alias2 [3 ]== 0xf6 );
29
+ assert (alias2 [4 ]== 0xf5 );
30
+ assert (alias2 [5 ]== 0xf4 );
31
+ assert (alias2 [6 ]== 0xf3 );
32
+ assert (alias2 [7 ]== 0xf2 );
33
+ assert (alias2 [8 ]== 0xf1 );
34
+ assert (alias2 [9 ]== 0x0a );
35
+
36
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+ #include <assert.h>
3
+
4
+ int main (int argc , char * * argv ) {
5
+
6
+ if (argc != 5 )
7
+ return 0 ;
8
+
9
+ short x [argc ];
10
+ x [0 ]= 0x0102 ;
11
+ x [1 ]= 0x0304 ;
12
+ x [2 ]= 0x0506 ;
13
+ x [3 ]= 0x0708 ;
14
+ x [4 ]= 0x090a ;
15
+
16
+ unsigned long * alias = (unsigned long * )(((char * )x )+ 1 );
17
+ * alias = 0xf1f2f3f4f5f6f7f8 ;
18
+
19
+ unsigned char * alias2 = (unsigned char * )x ;
20
+ assert (alias2 [0 ]== 0x02 );
21
+ assert (alias2 [1 ]== 0xf8 );
22
+ assert (alias2 [2 ]== 0xf7 );
23
+ assert (alias2 [3 ]== 0xf6 );
24
+ assert (alias2 [4 ]== 0xf5 );
25
+ assert (alias2 [5 ]== 0xf4 );
26
+ assert (alias2 [6 ]== 0xf3 );
27
+ assert (alias2 [7 ]== 0xf2 );
28
+ assert (alias2 [8 ]== 0xf1 );
29
+ assert (alias2 [9 ]== 0x09 );
30
+
31
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+ #include <assert.h>
3
+
4
+ int main (int argc , char * * argv ) {
5
+
6
+ if (argc != 2 )
7
+ return 0 ;
8
+
9
+ unsigned long x [argc ];
10
+ x [0 ]= 0x0102030405060708 ;
11
+ x [1 ]= 0x1112131415161718 ;
12
+
13
+ unsigned short * alias = (unsigned short * )(((char * )x )+ 8 );
14
+ * alias = 0xedcb ;
15
+
16
+ unsigned char * alias2 = (unsigned char * )x ;
17
+ /*
18
+ for(int i = 0; i < 16; ++i)
19
+ printf("%02hhx\n",alias2[i]);
20
+ */
21
+
22
+ assert (alias2 [0 ]== 0x08 );
23
+ assert (alias2 [1 ]== 0x07 );
24
+ assert (alias2 [2 ]== 0x06 );
25
+ assert (alias2 [3 ]== 0x05 );
26
+ assert (alias2 [4 ]== 0x04 );
27
+ assert (alias2 [5 ]== 0x03 );
28
+ assert (alias2 [6 ]== 0x02 );
29
+ assert (alias2 [7 ]== 0x01 );
30
+ assert (alias2 [8 ]== 0xcb );
31
+ assert (alias2 [9 ]== 0xed );
32
+ assert (alias2 [10 ]== 0x16 );
33
+ assert (alias2 [11 ]== 0x15 );
34
+ assert (alias2 [12 ]== 0x14 );
35
+ assert (alias2 [13 ]== 0x13 );
36
+ assert (alias2 [14 ]== 0x12 );
37
+ assert (alias2 [15 ]== 0x11 );
38
+
39
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+ #include <assert.h>
3
+
4
+ int main (int argc , char * * argv ) {
5
+
6
+ if (argc != 2 )
7
+ return 0 ;
8
+
9
+ unsigned long x [argc ];
10
+ x [0 ]= 0x0102030405060708 ;
11
+ x [1 ]= 0x1112131415161718 ;
12
+
13
+ unsigned short * alias = (unsigned short * )(((char * )x )+ 7 );
14
+ * alias = 0xedcb ;
15
+
16
+ unsigned char * alias2 = (unsigned char * )x ;
17
+ /*
18
+ for(int i = 0; i < 16; ++i)
19
+ printf("%02hhx\n",alias2[i]);
20
+ */
21
+
22
+ assert (alias2 [0 ]== 0x08 );
23
+ assert (alias2 [1 ]== 0x07 );
24
+ assert (alias2 [2 ]== 0x06 );
25
+ assert (alias2 [3 ]== 0x05 );
26
+ assert (alias2 [4 ]== 0x04 );
27
+ assert (alias2 [5 ]== 0x03 );
28
+ assert (alias2 [6 ]== 0x02 );
29
+ assert (alias2 [7 ]== 0xcb );
30
+ assert (alias2 [8 ]== 0xed );
31
+ assert (alias2 [9 ]== 0x17 );
32
+ assert (alias2 [10 ]== 0x16 );
33
+ assert (alias2 [11 ]== 0x15 );
34
+ assert (alias2 [12 ]== 0x14 );
35
+ assert (alias2 [13 ]== 0x13 );
36
+ assert (alias2 [14 ]== 0x12 );
37
+ assert (alias2 [15 ]== 0x11 );
38
+
39
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ ^warning: ignoring
You can’t perform that action at this time.
0 commit comments