diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-05-26 22:45:24 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-06-01 15:01:59 +0200 |
| commit | cb054f8a75575150c994ddc874d55c3c58734454 (patch) | |
| tree | 1b664bb0a9c86b9f5ba4e8143a6eba07d4aa774b /validation | |
| parent | 943416a743501230f89879fa63d8186694df2e55 (diff) | |
| download | sparse-dev-cb054f8a75575150c994ddc874d55c3c58734454.tar.gz | |
fix crash on 'goto <reserved word>'
On code like 'goto <some reserved code>', bind_symbol() reports
an error and doesn't bind the label's ident to the goto's label
symbol.
However, at evaluation time, the ident is unconditionally
dereferenced.
Avoid the crash by checking for a null ident before dereferencing it.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
| -rw-r--r-- | validation/goto-reserved.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/validation/goto-reserved.c b/validation/goto-reserved.c new file mode 100644 index 00000000..fbaf03e1 --- /dev/null +++ b/validation/goto-reserved.c @@ -0,0 +1,12 @@ +static void foo(void) +{ + goto return; +} + +/* + * check-name: goto-reserved + * + * check-error-start +goto-reserved.c:3:14: error: Trying to use reserved word 'return' as identifier + * check-error-end + */ |
