* src/pic16/glue.c, src/SDCC.y, src/SDCCast.c, src/SDCCglue.c,
src/SDCCsymt.c, src/SDCCsymt.h:
- unnamed bitfields are not initialized (gcc, msvc comatibility)
+ fixed RFE #2291335 : Unnamed bit-field initialization
+ * support/regression/tests/bitfields.c:
+ added test case for RFE #2291335
2008-11-11 Raphael Neider <rneider AT web.de>
if (0 == SPEC_BLEN (lsym->etype))
{
/* bit-field structure member with a width of 0 */
+ lsym = lsym->next;
break;
}
else if (!SPEC_BUNNAMED (lsym->etype))
if (IS_BITFIELD (sflds->type))
printIvalBitFields(&sflds, &iloop, oBuf);
else
- printIval (sym, sflds->type, iloop, oBuf, 1);
- sflds = sflds->next;
- iloop = iloop ? iloop->next : NULL;
+ {
+ printIval (sym, sflds->type, iloop, oBuf, 1);
+ sflds = sflds->next;
+ iloop = iloop ? iloop->next : NULL;
+ }
}
}
if (0 == SPEC_BLEN (lsym->etype))
{
/* bit-field structure member with a width of 0 */
+ lsym = lsym->next;
break;
}
else if (!SPEC_BUNNAMED (lsym->etype))
long l17_15 : 15;
} l_bf;
-
struct {
unsigned int b0 : 1;
unsigned int b1 : 1;
ASSERT(s_bf.s8_9 > 0);
#endif /* !SDCC_pic16 */
}
+
+/* test case for enhancement request #2291335 : Unnamed bit-field initialization */
+
+struct s2291335_1 {
+ int a : 2;
+ char : 2;
+ int b : 2;
+};
+
+struct s2291335_2 {
+ int a : 2;
+ char : 0;
+ int b : 2;
+};
+
+struct s2291335_1 gs2291335_1 = {1, 2};
+struct s2291335_2 gs2291335_2 = {1, 2};
+
+void
+__test2291335(void)
+{
+ struct s2291335_1 ls2291335_1 = {1, 2};
+ struct s2291335_2 ls2291335_2 = {1, 2};
+
+ ASSERT(gs2291335_1.a == 1);
+ ASSERT(gs2291335_1.b == 2);
+ ASSERT(gs2291335_2.a == 1);
+ ASSERT(gs2291335_2.b == 2);
+
+ ASSERT(ls2291335_1.a == 1);
+ ASSERT(ls2291335_1.b == 2);
+ ASSERT(ls2291335_2.a == 1);
+ ASSERT(ls2291335_2.b == 2);
+}