1 extern void *malloc(__SIZE_TYPE__
);
2 extern void *memset(void *, int, __SIZE_TYPE__
);
8 unsigned long long Count
;
10 } __attribute__((packed
)) Struct1
;
20 } __attribute__((packed
)) Struct2
;
32 } __attribute__((packed
)) Struct3
;
34 unsigned long long Sum (Struct3
*instrs
) __attribute__((noinline
));
35 unsigned long long Sum (Struct3
*instrs
)
37 unsigned long long count
= 0;
40 for (i
= 0; i
< instrs
->Count
; i
++) {
41 count
+= instrs
->List
[i
].a
.Count
;
45 long long Sum2 (Struct3
*instrs
) __attribute__((noinline
));
46 long long Sum2 (Struct3
*instrs
)
51 for (i
= 0; i
< instrs
->Count
; i
++) {
52 count
+= instrs
->List
[i
].a
.Count2
;
57 Struct3
*p
= malloc (sizeof (int) + 3 * sizeof(Union
));
58 memset(p
, 0, sizeof(int) + 3*sizeof(Union
));
60 p
->List
[0].a
.Count
= 555;
61 p
->List
[1].a
.Count
= 999;
62 p
->List
[2].a
.Count
= 0x101010101ULL
;
63 p
->List
[0].a
.Count2
= 555;
64 p
->List
[1].a
.Count2
= 999;
65 p
->List
[2].a
.Count2
= 0x101010101LL
;
66 if (Sum(p
) != 555 + 999 + 0x101010101ULL
)
68 if (Sum2(p
) != 555 + 999 + 0x101010101LL
)