Module Name:    src
Committed By:   rillig
Date:           Mon May 22 11:51:46 UTC 2023

Modified Files:
        src/tests/usr.bin/xlint/lint1: emit.c emit.exp-ln

Log Message:
tests/lint: demonstrate wrong emitted array length in initialization

Seen in usr.bin/indent/debug.c, in the various 'name' arrays.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/tests/usr.bin/xlint/lint1/emit.c
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/xlint/lint1/emit.exp-ln

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/emit.c
diff -u src/tests/usr.bin/xlint/lint1/emit.c:1.15 src/tests/usr.bin/xlint/lint1/emit.c:1.16
--- src/tests/usr.bin/xlint/lint1/emit.c:1.15	Tue Mar 28 14:44:34 2023
+++ src/tests/usr.bin/xlint/lint1/emit.c	Mon May 22 11:51:46 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: emit.c,v 1.15 2023/03/28 14:44:34 rillig Exp $	*/
+/*	$NetBSD: emit.c,v 1.16 2023/05/22 11:51:46 rillig Exp $	*/
 # 3 "emit.c"
 
 /*
@@ -307,3 +307,12 @@ struct compound_expression_in_initialize
 		[0] = "zero",
 	},
 };
+
+/*
+ * FIXME: The type that ends up in the .ln file is 'A0cC', which is wrong as it
+ * has array size 0 instead of the correct 8.
+ *
+ * This is caused by cgram_declare being called before processing the
+ * initializer.
+ */
+const char array_of_unknown_size[] = "unknown";

Index: src/tests/usr.bin/xlint/lint1/emit.exp-ln
diff -u src/tests/usr.bin/xlint/lint1/emit.exp-ln:1.10 src/tests/usr.bin/xlint/lint1/emit.exp-ln:1.11
--- src/tests/usr.bin/xlint/lint1/emit.exp-ln:1.10	Sat Jan 15 14:22:03 2022
+++ src/tests/usr.bin/xlint/lint1/emit.exp-ln	Mon May 22 11:51:46 2023
@@ -82,3 +82,4 @@ Semit.c
 289u0.289x16defined_used_var
 286d0.286d8use_varsF0V
 305d0.305d8compoundsT134compound_expression_in_initializer
+318d0.318d21array_of_unknown_sizeA0cC

Reply via email to