Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!DG-RTP.DG.COM!meissner From: meissner@DG-RTP.DG.COM (Michael Meissner) Newsgroups: gnu.gcc.bug Subject: Initialization of unnamed bitfields Message-ID: <8907191931.AA03647@tiktok.dg.com> Date: 19 Jul 89 19:31:31 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 40 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;