diff options
author | 2010-03-28 22:41:49 -0700 | |
---|---|---|
committer | 2010-03-29 00:43:33 -0700 | |
commit | 703499e552b45542a328e3016868419d65143f2b (patch) | |
tree | 929fe7f03c80acb756d9f7856a60c8e3ed1015d5 | |
parent | Pointer don't inherent the alignment from base type (diff) | |
download | sparse-703499e552b45542a328e3016868419d65143f2b.tar.gz sparse-703499e552b45542a328e3016868419d65143f2b.tar.bz2 sparse-703499e552b45542a328e3016868419d65143f2b.zip |
evaluate: check for NULL type inside typeof
This should fix the segfault report by Randy.
It still doesn't parse the struct attribute correctly though.
Signed-off-by: Christopher <sparse@chrisli.org>
-rw-r--r-- | evaluate.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -340,7 +340,9 @@ static inline int classify_type(struct symbol *type, struct symbol **base) type = type->ctype.base_type; if (type->type == SYM_TYPEOF) { type = evaluate_expression(type->initializer); - if (type->type == SYM_NODE) + if (!type) + type = &bad_ctype; + else if (type->type == SYM_NODE) type = type->ctype.base_type; } if (type->type == SYM_ENUM) |