aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2005-11-21 22:06:43 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-22 08:43:02 -0800
commitea92e467f57dc19726c7f63d22932e2e961bac50 (patch)
treeccc2e9ba91eee7b45f65ff0b1c55bddf2b19c32f /inline.c
parent[PATCH] fix treatment of EXPR_COMMA by show_expression() (diff)
downloadsparse-ea92e467f57dc19726c7f63d22932e2e961bac50.tar.gz
sparse-ea92e467f57dc19726c7f63d22932e2e961bac50.tar.bz2
sparse-ea92e467f57dc19726c7f63d22932e2e961bac50.zip
[PATCH] fix of compound literals on inlining
We need to create a copy of cast_type when we are copying a combination of EXPR_CAST and EXPR_INITIALIZER (i.e. a compound literal). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'inline.c')
-rw-r--r--inline.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/inline.c b/inline.c
index 88c442e..72d2f4f 100644
--- a/inline.c
+++ b/inline.c
@@ -135,6 +135,15 @@ static struct expression * copy_expression(struct expression *expr)
/* Cast/sizeof/__alignof__ */
case EXPR_CAST:
+ if (expr->cast_expression->type == EXPR_INITIALIZER) {
+ struct expression *cast = expr->cast_expression;
+ struct symbol *sym = expr->cast_type;
+ expr = dup_expression(expr);
+ expr->cast_expression = copy_expression(cast);
+ expr->cast_type = alloc_symbol(sym->pos, sym->type);
+ *expr->cast_type = *sym;
+ break;
+ }
case EXPR_IMPLIED_CAST:
case EXPR_SIZEOF:
case EXPR_PTRSIZEOF: