diff options
| author | Linus Torvalds <torvalds@penguin.transmeta.com> | 2003-04-09 19:23:23 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:00:27 -0700 |
| commit | 53a0adb26d707df1ddd7dc2b24a0b5648cbe5d89 (patch) | |
| tree | 8341a5ea49fd24238c44f37f7b985780b0b16255 | |
| parent | c906c75fc353ecdaf288d22ed947ceff83683d50 (diff) | |
| download | sparse-dev-53a0adb26d707df1ddd7dc2b24a0b5648cbe5d89.tar.gz | |
Fix type merging at dereference evaluation time.
Use the existing type merging function.
| -rw-r--r-- | evaluate.c | 6 | ||||
| -rw-r--r-- | symbol.c | 2 | ||||
| -rw-r--r-- | symbol.h | 1 |
3 files changed, 6 insertions, 3 deletions
@@ -866,13 +866,15 @@ static struct symbol *evaluate_dereference(struct expression *expr) struct symbol *ctype = op->ctype, *sym; sym = alloc_symbol(expr->pos, SYM_NODE); - if (ctype->type == SYM_NODE) + sym->ctype = ctype->ctype; + if (ctype->type == SYM_NODE) { ctype = ctype->ctype.base_type; + merge_type(sym, ctype); + } if (ctype->type != SYM_PTR && ctype->type != SYM_ARRAY) { warn(expr->pos, "cannot derefence this type"); return 0; } - sym->ctype = ctype->ctype; ctype = ctype->ctype.base_type; examine_symbol_type(ctype); @@ -176,7 +176,7 @@ static void examine_bitfield_type(struct symbol *sym) /* * "typeof" will have to merge the types together */ -static void merge_type(struct symbol *sym, struct symbol *base_type) +void merge_type(struct symbol *sym, struct symbol *base_type) { sym->ctype.as |= base_type->ctype.as; sym->ctype.modifiers |= base_type->ctype.modifiers; @@ -189,5 +189,6 @@ extern void examine_simple_symbol_type(struct symbol *); extern const char *show_typename(struct symbol *sym); extern void debug_symbol(struct symbol *); +extern void merge_type(struct symbol *sym, struct symbol *base_type); #endif /* SEMANTIC_H */ |
