cp_error039: Pragma pack not supported
authorMoritz Kroll <Moritz.Kroll@gmx.de>
Sat, 2 Aug 2008 10:57:50 +0000 (10:57 +0000)
committerMoritz Kroll <Moritz.Kroll@gmx.de>
Sat, 2 Aug 2008 10:57:50 +0000 (10:57 +0000)
[r20938]

parsetest/cp_error039.c [new file with mode: 0644]

diff --git a/parsetest/cp_error039.c b/parsetest/cp_error039.c
new file mode 100644 (file)
index 0000000..42b8d74
--- /dev/null
@@ -0,0 +1,32 @@
+#pragma pack(push,2)
+typedef struct teststruct {
+       char a;
+       int b;
+} teststruct_t;
+#pragma pack(pop)
+
+typedef struct teststruct2 {
+       char a;
+       int b;
+} teststruct2_t;
+
+int main(void)
+{
+       struct teststruct t;
+       struct teststruct2 t2;
+
+       memset(&t, 0, sizeof(t));
+       t.a = 0xEF;
+       t.b = 0x12345678;
+
+       memset(&t2, 0, sizeof(t2));
+       t2.a = 0xEF;
+       t2.b = 0x12345678;
+
+       printf("%.8X %.2X %.8X %.2X\n", *(unsigned int *) &t,
+               (unsigned int) *((unsigned char *) &t + 4),
+               *(unsigned int *) &t2,
+               (unsigned int) *((unsigned char *) &t2 + 4));
+
+       return 0;
+}