diff options
| author | Christopher Li <sparse@chrisli.org> | 2007-02-09 16:15:40 -0800 |
|---|---|---|
| committer | Josh Triplett <josh@freedesktop.org> | 2007-02-22 20:29:15 -0800 |
| commit | 3849151a8fd01d1bc3536eb17949f862da900710 (patch) | |
| tree | 6f83cebc30b93c70b2079922acf268bcbeb3c2b8 /linearize.c | |
| parent | 35fc4ae6e7a789a9a739c3a68af7dd8630c3e10c (diff) | |
| download | sparse-dev-3849151a8fd01d1bc3536eb17949f862da900710.tar.gz | |
Fix core dump on anonymous symbol.
Using the following can generate anonymous symbol without
initializer expression.
return (struct foo) {};
It would be nice if sparse does not crash on it.
Signed-Off-By: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'linearize.c')
| -rw-r--r-- | linearize.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/linearize.c b/linearize.c index 13cdf716..7b43b2ce 100644 --- a/linearize.c +++ b/linearize.c @@ -116,14 +116,16 @@ const char *show_pseudo(pseudo_t pseudo) } expr = sym->initializer; snprintf(buf, 64, "<anon symbol:%p>", sym); - switch (expr->type) { - case EXPR_VALUE: - snprintf(buf, 64, "<symbol value: %lld>", expr->value); - break; - case EXPR_STRING: - return show_string(expr->string); - default: - break; + if (expr) { + switch (expr->type) { + case EXPR_VALUE: + snprintf(buf, 64, "<symbol value: %lld>", expr->value); + break; + case EXPR_STRING: + return show_string(expr->string); + default: + break; + } } break; } |
