Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/991118-1.c

raw
1 void abort (void);
2 void exit (int);
3
4 struct tmp
5 {
6 long long int pad : 12;
7 long long int field : 52;
8 };
9
10 struct tmp2
11 {
12 long long int field : 52;
13 long long int pad : 12;
14 };
15
16 struct tmp3
17 {
18 long long int pad : 11;
19 long long int field : 53;
20 };
21
22 struct tmp4
23 {
24 long long int field : 53;
25 long long int pad : 11;
26 };
27
28 struct tmp
29 sub (struct tmp tmp)
30 {
31 tmp.field ^= 0x0008765412345678LL;
32 return tmp;
33 }
34
35 struct tmp2
36 sub2 (struct tmp2 tmp2)
37 {
38 tmp2.field ^= 0x0008765412345678LL;
39 return tmp2;
40 }
41
42 struct tmp3
43 sub3 (struct tmp3 tmp3)
44 {
45 tmp3.field ^= 0x0018765412345678LL;
46 return tmp3;
47 }
48
49 struct tmp4
50 sub4 (struct tmp4 tmp4)
51 {
52 tmp4.field ^= 0x0018765412345678LL;
53 return tmp4;
54 }
55
56 struct tmp tmp = {0x123, 0x123456789ABCDLL};
57 struct tmp2 tmp2 = {0x123456789ABCDLL, 0x123};
58 struct tmp3 tmp3 = {0x123, 0x1FFFF00000000LL};
59 struct tmp4 tmp4 = {0x1FFFF00000000LL, 0x123};
60
61 int
62 main(void)
63 {
64
65 if (sizeof (long long) != 8)
66 exit (0);
67
68 tmp = sub (tmp);
69 tmp2 = sub2 (tmp2);
70
71 if (tmp.pad != 0x123 || tmp.field != 0xFFF9551175BDFDB5LL)
72 abort ();
73 if (tmp2.pad != 0x123 || tmp2.field != 0xFFF9551175BDFDB5LL)
74 abort ();
75
76 tmp3 = sub3 (tmp3);
77 tmp4 = sub4 (tmp4);
78 if (tmp3.pad != 0x123 || tmp3.field != 0xFFF989AB12345678LL)
79 abort ();
80 if (tmp4.pad != 0x123 || tmp4.field != 0xFFF989AB12345678LL)
81 abort ();
82 exit (0);
83 }