diff options
author | 2006-12-15 00:35:47 +0300 | |
---|---|---|
committer | 2007-02-22 21:26:52 -0800 | |
commit | 6983e0f5213027c271dafd4603d729693bf3139f (patch) | |
tree | de4fd4bb7d32ebf652e6fbbad9e8240543f1a96c /dissect.c | |
parent | Fix core dump on anonymous symbol. (diff) | |
download | sparse-6983e0f5213027c271dafd4603d729693bf3139f.tar.gz sparse-6983e0f5213027c271dafd4603d729693bf3139f.tar.bz2 sparse-6983e0f5213027c271dafd4603d729693bf3139f.zip |
dissect: fix multidimensional array initializer
dissect can't parse initializers like
struct T { int i; } a[2][3] = { [0][0] = {123} };
, output is:
1:8 s def T
1:21 g def a struct T [3][2]
1:21 g -w- a struct T [3][2]
T.c:1:37: warning: bad expr->type: 25
with this patch applied:
1:8 s def T
1:21 g def a struct T [3][2]
1:21 g -w- a struct T [3][2]
1:43 s -w- T.i int
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Diffstat (limited to 'dissect.c')
-rw-r--r-- | dissect.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -509,10 +509,13 @@ static struct symbol *do_initializer(struct symbol *type, struct expression *exp default: do_expression(u_lval(type), expr); + break; case EXPR_INDEX: + do_initializer(base_type(type), expr->idx_expression); + break; case EXPR_INITIALIZER: m_addr = 0; FOR_EACH_PTR(expr->expr_list, m_expr) - if(type->type == SYM_ARRAY) { + if (type->type == SYM_ARRAY) { m_type = base_type(type); if (m_expr->type == EXPR_INDEX) m_expr = m_expr->idx_expression; |