* support/regression/tests/bug1426356.c: added
* support/regression/tests/bitfields.c: removed 2 tests
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4036
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+2006-02-11 Maarten Brock <sourceforge.brock AT dse.nl>
+
+ * src/SDCCglue.c (printIvalStruct): fixed bug 1426356 union initializer
+ * support/regression/tests/bug1426356.c: added
+ * support/regression/tests/bitfields.c: removed 2 tests
+
2006-02-10 Maarten Brock <sourceforge.brock AT dse.nl>
* device/include/mcs51/at89c51snd1c.h: updated comments, see patch 1428901
2006-02-10 Maarten Brock <sourceforge.brock AT dse.nl>
* device/include/mcs51/at89c51snd1c.h: updated comments, see patch 1428901
iloop = ilist->init.deep;
}
iloop = ilist->init.deep;
}
- for (; sflds; sflds = sflds->next, iloop = (iloop ? iloop->next : NULL)) {
- if (IS_BITFIELD(sflds->type)) {
- printIvalBitFields(&sflds,&iloop,oFile);
- } else {
- printIval (sym, sflds->type, iloop, oFile);
+ if (SPEC_STRUCT (type)->type == UNION) {
+ printIval (sym, sflds->type, iloop, oFile);
+ iloop = iloop->next;
+ } else {
+ for (; sflds; sflds = sflds->next, iloop = (iloop ? iloop->next : NULL)) {
+ if (IS_BITFIELD(sflds->type)) {
+ printIvalBitFields(&sflds,&iloop,oFile);
+ } else {
+ printIval (sym, sflds->type, iloop, oFile);
+ }
ASSERT( sizeof(size1a_bf) >= 1);
ASSERT( sizeof(size1b_bf) >= 1);
ASSERT( sizeof(size1c_bf) >= 1);
ASSERT( sizeof(size1a_bf) >= 1);
ASSERT( sizeof(size1b_bf) >= 1);
ASSERT( sizeof(size1c_bf) >= 1);
-#if !defined (__amd64__) && !defined(__CYGWIN32__) && !defined(__MINGW32__)
- /* assertion fails on amd64, cygwin and mingw.
- Maybe it depends on gcc version?
- */
- ASSERT( sizeof(size2a_bf) >= 2);
-#endif
ASSERT( sizeof(size2b_bf) >= 2);
ASSERT( sizeof(size2c_bf) >= 2);
ASSERT( sizeof(size2d_bf) >= 2);
ASSERT( sizeof(size3a_bf) >= 2);
ASSERT( sizeof(size1a_bf) <= sizeof(size1b_bf));
ASSERT( sizeof(size2b_bf) >= 2);
ASSERT( sizeof(size2c_bf) >= 2);
ASSERT( sizeof(size2d_bf) >= 2);
ASSERT( sizeof(size3a_bf) >= 2);
ASSERT( sizeof(size1a_bf) <= sizeof(size1b_bf));
-#if !defined (__amd64__) && !defined(__CYGWIN32__) && !defined(__MINGW32__)
- /* assertion fails on amd64, cygwin and mingw.
- Maybe it depends on gcc version?
- */
- ASSERT( sizeof(size1a_bf) < sizeof(size2a_bf));
-#endif
/* Some SDCC specific assertions. SDCC uses 8 bit storage units.
Bitfields that are less than 8 bits, but would (due to earlier
/* Some SDCC specific assertions. SDCC uses 8 bit storage units.
Bitfields that are less than 8 bits, but would (due to earlier
--- /dev/null
+/*
+ bug1426356.c
+*/
+
+#include <testfwk.h>
+
+const union pu {
+ unsigned char t1;
+ unsigned char t2;
+} tst[2] = {{ 1 }, { 2 }};
+
+void
+test_1426356(void)
+{
+ ASSERT( tst[0].t1 == 1 );
+ ASSERT( tst[0].t2 == 1 );
+ ASSERT( tst[1].t1 == 2 );
+ ASSERT( tst[1].t2 == 2 );
+}