aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLinus Torvalds <torvalds@ppc970.osdl.org>2004-10-02 18:53:09 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:03:26 -0700
commitbd657dfca927b2e4d72001417b20ace0866acfe1 (patch)
tree68b552d11140827a91e71bf39d2640dfdc2fcf80
parent4250a6355c2a29764f5a8b31a1a22087439068dd (diff)
downloadsparse-dev-bd657dfca927b2e4d72001417b20ace0866acfe1.tar.gz
We actually _can_ have multiple initializers at offset zero.
It's not an error, it just is pretty rare. It happens when there are bitfields that are all at byte offset zero, and we need to allocate a new EXPR_POS when we offset these bitfields due to them being inside a nested initializer.
-rw-r--r--expand.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/expand.c b/expand.c
index c02a2388..7a5c332c 100644
--- a/expand.c
+++ b/expand.c
@@ -720,8 +720,12 @@ static int expand_pos_expression(struct expression *expr)
entry->init_offset += offset;
} else {
if (!reuse) {
- error(entry->pos, "multiple initializers at offset zero");
- return SIDE_EFFECTS;
+ /*
+ * This happens rarely, but it can happen
+ * with bitfields that are all at offset
+ * zero..
+ */
+ reuse = alloc_expression(entry->pos, EXPR_POS);
}
reuse->type = EXPR_POS;
reuse->ctype = entry->ctype;