aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/backend
diff options
authorXi Wang <xi.wang@gmail.com>2013-05-21 04:05:19 -0400
committerPekka Enberg <penberg@kernel.org>2013-05-21 12:21:09 +0300
commit5b950a99d4a81db8581741def3ea6acf05b0b493 (patch)
tree2a7bfbd28b699687b559b800553bdc6cc7dd05bd /validation/backend
parent4858eafe71ea9cd6e61a8ee2883e2cde28430f20 (diff)
downloadsparse-dev-5b950a99d4a81db8581741def3ea6acf05b0b493.tar.gz
sparse, llvm: fix struct name generation
Avoid null pointer dereference when ->ident is null (e.g., anonymous struct). Also, use ->aux to avoid recursion. Signed-off-by: Xi Wang <xi.wang@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'validation/backend')
-rw-r--r--validation/backend/struct.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/validation/backend/struct.c b/validation/backend/struct.c
index 1afaf2db..905339af 100644
--- a/validation/backend/struct.c
+++ b/validation/backend/struct.c
@@ -9,10 +9,16 @@ struct symbol {
struct symbol *next_id;
};
+struct unnamed {
+ struct { int x, y; };
+};
+
static struct symbol sym;
static struct symbol *sym_p;
static struct symbol *sym_q = &sym;
+static struct unnamed un;
+
/*
* check-name: Struct code generation
* check-command: ./sparsec -c $file -o tmp.o