[gnu.gcc.bug] Initialization of unnamed bitfields

meissner@DG-RTP.DG.COM (Michael Meissner) (07/20/89)

It appears that GCC 1.35 is not properly skipping unnamed bitfields
when initializing a structure.  The following program:

	struct {
		int 	  : 8;
		int field : 8;
	} s = { 1 };

	main(){
		printf("s.field = %d\n", s.field);
		return 0;
	}

produces:

	s.field = 0

when it should produce:

	s.field = 1

The following patch should take care of it.

*** .rev11/c-typeck.c	Wed Jul 19 15:17:34 1989
--- c-typeck.c	Wed Jul 19 12:50:34 1989
***************
*** 3532,3537 ****
--- 3532,3543 ----
  	{
  	  register tree next1;
  
+ 	  if (! DECL_NAME (field))
+ 	    {
+ 	      members = tree_cons (field, integer_zero_node, members);
+ 	      continue;
+ 	    }
+ 	  
  	  if (TREE_VALUE (tail) != 0)
  	    {
  	      tree tail1 = tail;