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] Fix bitfield-- != 0 transformation in fold-const.c


Hi Roger,

>   struct {
>     unsigned int bit0:1;
>     unsigned int bit1:1;
>     unsigned int bit2:1;
>     unsigned int bit3:1;
>     unsigned int bit4:1;
>     unsigned int bit5:1;
>     unsigned int bit6:1;
>     unsigned int bit7:1;
>     unsigned int ubyte:24;
>   } sdata = {0x01};

"unsigned int ubyte:24" would fail on 16-bit targets.

Tested the following patch on h8300-elf.  OK to apply?

Kazu Hirata

2004-03-11  Kazu Hirata  <kazu@cs.umass.edu>

	* gcc.c-torture/execute/20040307-1.c: Don't create a bit field
	larger than the size of int.

Index: 20040307-1.c
===================================================================
RCS file: /home/kazu/nobackup/gcc-cvs/gcc/gcc/testsuite/gcc.c-torture/execute/20040307-1.c,v
retrieving revision 1.1
diff -u -r1.1 20040307-1.c
--- 20040307-1.c	7 Mar 2004 14:45:42 -0000	1.1
+++ 20040307-1.c	11 Mar 2004 18:18:11 -0000
@@ -11,7 +11,9 @@
     unsigned int bit5:1;
     unsigned int bit6:1;
     unsigned int bit7:1;
+#if __INT_MAX__ >= 2147483647
     unsigned int ubyte:24;
+#endif
   } sdata = {0x01};
 
   while ( sdata.bit0-- > 0 ) {


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