1 extern void abort(void);
2 extern void *malloc(__SIZE_TYPE__
);
3 extern void *memset(void *, int, __SIZE_TYPE__
);
9 unsigned long long Count
;
11 } __attribute__((packed
)) Struct1
;
21 } __attribute__((packed
)) Struct2
;
33 } __attribute__((packed
)) Struct3
;
35 unsigned long long Sum (Struct3
*instrs
) __attribute__((noinline
));
36 unsigned long long Sum (Struct3
*instrs
)
38 unsigned long long count
= 0;
41 for (i
= 0; i
< instrs
->Count
; i
++) {
42 count
+= instrs
->List
[i
].a
.Count
;
46 long long Sum2 (Struct3
*instrs
) __attribute__((noinline
));
47 long long Sum2 (Struct3
*instrs
)
52 for (i
= 0; i
< instrs
->Count
; i
++) {
53 count
+= instrs
->List
[i
].a
.Count2
;
58 Struct3
*p
= malloc (sizeof (int) + 3 * sizeof(Union
));
59 memset(p
, 0, sizeof(int) + 3*sizeof(Union
));
61 p
->List
[0].a
.Count
= 555;
62 p
->List
[1].a
.Count
= 999;
63 p
->List
[2].a
.Count
= 0x101010101ULL
;
64 p
->List
[0].a
.Count2
= 555;
65 p
->List
[1].a
.Count2
= 999;
66 p
->List
[2].a
.Count2
= 0x101010101LL
;
67 if (Sum(p
) != 555 + 999 + 0x101010101ULL
)
69 if (Sum2(p
) != 555 + 999 + 0x101010101LL
)