This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Packed union doesn't make the unaligned magic on ms_bitfield


Eric Christopher <echristo@apple.com> wrote:
> After some further thought I think this is the correct approach and,  
> and provided you get a testcase recommend someone with approval  
> rights approve it.

How does look the attached testcase?

Regards,
	kaz
--
	* gcc.dg/attr-ms_struct-packed1.c: New.

diff -uprN ORIG/trunk/gcc/testsuite/gcc.dg/attr-ms_struct-packed1.c LOCAL/trunk/gcc/testsuite/gcc.dg/attr-ms_struct-packed1.c
--- ORIG/trunk/gcc/testsuite/gcc.dg/attr-ms_struct-packed1.c	1970-01-01 09:00:00.000000000 +0900
+++ LOCAL/trunk/gcc/testsuite/gcc.dg/attr-ms_struct-packed1.c	2006-06-09 19:43:21.000000000 +0900
@@ -0,0 +1,25 @@
+/* Test for MS structure with packed attribute.  */
+/* { dg-do run { target *-*-interix* *-*-mingw* *-*-cygwin* i?86-*-darwin* }} */
+/* { dg-options "-std=gnu99" } */
+
+extern void abort ();
+
+union u
+{
+  int a;
+} __attribute__((__ms_struct__, __packed__));
+
+struct s
+{
+  char c;
+  union u u;
+};
+
+int
+main (void)
+{
+  if (sizeof (struct s) != (sizeof (char) + sizeof (union u))) 
+    abort ();
+
+  return 0;
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]