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: Patch for Microsoft bitfield layout


Richard Sandiford <rsandifo@redhat.com> writes:
> *** /dev/null	Tue Nov 14 21:44:43 2000
> --- testsuite/gcc.dg/bitfld-5.c	Tue Nov 12 12:46:32 2002
> ***************
> *** 0 ****
> --- 1,12 ----
> + /* { dg-options "" } */
> + #include <limits.h>
> + 
> + struct s
> + {
> +   int i1 : sizeof (int) * CHAR_BIT;
> +   int i2 : sizeof (int) * CHAR_BIT;
> +   int i3 : sizeof (int) * CHAR_BIT;
> +   int i4 : sizeof (int) * CHAR_BIT;
> + };
> + 
> + int f[sizeof (struct s) != sizeof (int) * 4 ? -1 : 1];

This test case wasn't enough to show the problem on interix
because its BIGGEST_ALIGNMENT is 128 (vs. 64 for sh64-elf).
I've applied the following patch as an obvious extension
of the test above.

Richard


Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/ChangeLog,v
retrieving revision 1.2236
diff -c -p -d -r1.2236 ChangeLog
*** ChangeLog	27 Nov 2002 13:49:30 -0000	1.2236
--- ChangeLog	27 Nov 2002 15:17:08 -0000
***************
*** 1,3 ****
--- 1,7 ----
+ 2002-11-27  Richard Sandiford  <rsandifo@redhat.com>
+ 
+ 	* gcc.dg/bitfld-6.c: New test.
+ 
  Wed Nov 27 14:37:34 CET 2002  Jan Hubicka  <jh@suse.cz>
  
  	* gcc.c-torture/execute/20021127.[cx]: New test.
Index: gcc.dg/bitfld-6.c
===================================================================
RCS file: gcc.dg/bitfld-6.c
diff -N gcc.dg/bitfld-6.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- gcc.dg/bitfld-6.c	27 Nov 2002 15:17:08 -0000
***************
*** 0 ****
--- 1,16 ----
+ /* { dg-options "" } */
+ #include <limits.h>
+ 
+ struct s
+ {
+   int i1 : sizeof (int) * CHAR_BIT;
+   int i2 : sizeof (int) * CHAR_BIT;
+   int i3 : sizeof (int) * CHAR_BIT;
+   int i4 : sizeof (int) * CHAR_BIT;
+   int i5 : sizeof (int) * CHAR_BIT;
+   int i6 : sizeof (int) * CHAR_BIT;
+   int i7 : sizeof (int) * CHAR_BIT;
+   int i8 : sizeof (int) * CHAR_BIT;
+ };
+ 
+ int f[sizeof (struct s) != sizeof (int) * 8 ? -1 : 1];


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