diff options
| author | rillig <rillig@NetBSD.org> | 2022-04-03 00:39:32 +0000 |
|---|---|---|
| committer | rillig <rillig@NetBSD.org> | 2022-04-03 00:39:32 +0000 |
| commit | 4e684ee09e491c896e67eccf6b43bd39c76a22af (patch) | |
| tree | 91252dc2b5dbb139f8d7831b5236780dda2a0dae /tests | |
| parent | 62c949d085b04303064086049ca087fca376b3e3 (diff) | |
lint: fix crash after syntax error in GCC statement expression
Since cgram.y 1.226 from 2021-05-03.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.c | 15 | ||||
| -rw-r--r-- | tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.exp | 1 |
2 files changed, 15 insertions, 1 deletions
diff --git a/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.c b/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.c index 0bfad6835f9..cea5f357c84 100644 --- a/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.c +++ b/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.c @@ -1,4 +1,4 @@ -/* $NetBSD: d_gcc_compound_statements1.c,v 1.7 2022/01/15 14:22:03 rillig Exp $ */ +/* $NetBSD: d_gcc_compound_statements1.c,v 1.8 2022/04/03 00:39:32 rillig Exp $ */ # 3 "d_gcc_compound_statements1.c" /* GCC compound statement with expression */ @@ -37,3 +37,16 @@ function(void) 0->e; }); } + +void +crash(void) +{ + /* + * Before tree.c 1.418 from 2022-04-03, lint dereferenced a null + * pointer in do_statement_expr. + */ + ({ + /* expect+1: error: syntax error ';' [249] */ + ; + }); +} diff --git a/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.exp b/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.exp index a0fa61e6fd3..09d1c93a3b7 100644 --- a/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.exp +++ b/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.exp @@ -1,3 +1,4 @@ d_gcc_compound_statements1.c(24): error: syntax error 'return outside function' [249] d_gcc_compound_statements1.c(25): error: cannot initialize 'int' from 'void' [185] d_gcc_compound_statements1.c(37): error: type 'int' does not have member 'e' [101] +d_gcc_compound_statements1.c(50): error: syntax error ';' [249] |
