diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-01-01 19:25:40 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-01-02 17:46:12 +0100 |
| commit | be8017fdf5eb8e58fd37e576eae7b021232ac57b (patch) | |
| tree | 541393fd73130745d8d1a2d4b463052751982a7a | |
| parent | 5826deab5956e5090ca73da7ec1cf8b8716780ad (diff) | |
| download | sparse-dev-be8017fdf5eb8e58fd37e576eae7b021232ac57b.tar.gz | |
fix: dereference null-type
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
| -rw-r--r-- | memops.c | 2 | ||||
| -rw-r--r-- | validation/bug-bad-type.c | 18 |
2 files changed, 20 insertions, 0 deletions
@@ -160,6 +160,8 @@ static void kill_dominated_stores(struct basic_block *bb) pseudo_t pseudo = insn->src; int local; + if (!insn->type) + continue; if (insn->type->ctype.modifiers & MOD_VOLATILE) continue; diff --git a/validation/bug-bad-type.c b/validation/bug-bad-type.c new file mode 100644 index 00000000..0e00efef --- /dev/null +++ b/validation/bug-bad-type.c @@ -0,0 +1,18 @@ +struct s { + int i; +}; + +long a; +void foo(void) +{ + (struct s) { .i = (foo - a), }; +} + +/* + * check-name: bug-bad-type + * + * check-error-start +bug-bad-type.c:5:6: warning: symbol 'a' was not declared. Should it be static? +bug-bad-type.c:8:32: error: arithmetics on pointers to functions + * check-error-end + */ |
