linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 13/16] in case of compound literal we want to delay examining type
@ 2007-06-24  8:05 Al Viro
  0 siblings, 0 replies; only message in thread
From: Al Viro @ 2007-06-24  8:05 UTC (permalink / raw)
  To: linux-sparse


... until we have initializer.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 evaluate.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/evaluate.c b/evaluate.c
index 60a11ff..e3b4940 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -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);
 
-- 
1.5.0-rc2.GIT

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-06-24  8:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-24  8:05 [PATCH 13/16] in case of compound literal we want to delay examining type Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).