diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2007-06-20 18:58:32 -0400 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2007-06-25 15:51:35 -0400 |
| commit | b0774891985015d7cdabacb3cc111e0291fd73f6 (patch) | |
| tree | 46413a2f4c2075fa6e11f26bc2832d3082ad2093 | |
| parent | 9e41f14b32eb0e7b9c1cd9e73a5775066048db0a (diff) | |
| download | sparse-dev-b0774891985015d7cdabacb3cc111e0291fd73f6.tar.gz | |
[PATCH] in case of compound literal we want to delay examining type
... until we have initializer.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| -rw-r--r-- | evaluate.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -2433,7 +2433,7 @@ out: static struct symbol *evaluate_cast(struct expression *expr) { struct expression *target = expr->cast_expression; - struct symbol *ctype = examine_symbol_type(expr->cast_type); + struct symbol *ctype; struct symbol *t1, *t2; int class1, class2; int as1, as2; @@ -2441,9 +2441,6 @@ static struct symbol *evaluate_cast(struct expression *expr) if (!target) return NULL; - expr->ctype = ctype; - expr->cast_type = ctype; - /* * Special case: a cast can be followed by an * initializer, in which case we need to pass @@ -2458,7 +2455,7 @@ static struct symbol *evaluate_cast(struct expression *expr) struct symbol *sym = expr->cast_type; struct expression *addr = alloc_expression(expr->pos, EXPR_SYMBOL); - sym->initializer = expr->cast_expression; + sym->initializer = target; evaluate_symbol(sym); addr->ctype = &lazy_ptr_ctype; /* Lazy eval */ @@ -2472,6 +2469,10 @@ static struct symbol *evaluate_cast(struct expression *expr) return sym; } + ctype = examine_symbol_type(expr->cast_type); + expr->ctype = ctype; + expr->cast_type = ctype; + evaluate_expression(target); degenerate(target); |
