Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/usr.bin/xlint/lint1 tests/lint: document how to reliab...



details:   https://anonhg.NetBSD.org/src/rev/65aa8e40b835
branches:  trunk
changeset: 377509:65aa8e40b835
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jul 15 09:53:46 2023 +0000

description:
tests/lint: document how to reliably crash lint1 after a parse error

diffstat:

 tests/usr.bin/xlint/lint1/d_lint_assert.c |  38 +++++++++++++++---------------
 1 files changed, 19 insertions(+), 19 deletions(-)

diffs (49 lines):

diff -r e66e7dfc0a2f -r 65aa8e40b835 tests/usr.bin/xlint/lint1/d_lint_assert.c
--- a/tests/usr.bin/xlint/lint1/d_lint_assert.c Sat Jul 15 09:40:36 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/d_lint_assert.c Sat Jul 15 09:53:46 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_lint_assert.c,v 1.8 2023/07/15 09:40:37 rillig Exp $ */
+/*     $NetBSD: d_lint_assert.c,v 1.9 2023/07/15 09:53:46 rillig Exp $ */
 # 3 "d_lint_assert.c"
 
 /*
@@ -25,21 +25,21 @@ enum {
 c(void());
 
 
-// As of 2023-07-15, the following code leads to a crash, due to the word
-// 'unknown_type_modifier'.  The parser then goes into error recovery mode and
-// discards the declaration in the 'for' loop.  In the end, the symbol table
-// still contains symbols that were already freed when parsing the '}' from the
-// 'switch' statement.  To reproduce the crash, run 'make -DDEBUG DBG="-O0 -g"'
-// and run with -Sy.
-//
-// static inline void
-// f(void)
-// {
-//     int i = 3;
-//
-//     for (unknown_type_modifier char *p = "";; ) {
-//             switch (i) {
-//             case 3:;
-//             }
-//     }
-// }
+// As of 2023-07-15, replacing 'const' with 'unknown_type_modifier' leads to a
+// crash.  When the '}' from the 'switch' statement is processed, symbols that
+// are already freed are still in the symbol table.  To reproduce the crash,
+// run:
+//     make -s -DDEBUG DBG="-O0 -g"
+//     MALLOC_OPTIONS='JA' MALLOC_CONF='junk:true' ./lint1 -Sy \
+//         ../../../tests/usr.bin/xlint/lint1/d_lint_assert.c
+ static inline void
+ f(void)
+ {
+       int i = 3;
+
+       for (const char *p = "";; ) {
+               switch (i) {
+               case 3:;
+               }
+       }
+ }



Home | Main Index | Thread Index | Old Index