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: trigger assertion fail...



details:   https://anonhg.NetBSD.org/src/rev/88f72312541a
branches:  trunk
changeset: 954008:88f72312541a
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Mar 27 15:49:33 2021 +0000

description:
tests/lint: trigger assertion failure in array initialization

diffstat:

 tests/usr.bin/xlint/lint1/d_c99_init.c |  31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diffs (43 lines):

diff -r 2589f074c1b1 -r 88f72312541a tests/usr.bin/xlint/lint1/d_c99_init.c
--- a/tests/usr.bin/xlint/lint1/d_c99_init.c    Sat Mar 27 13:59:18 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_init.c    Sat Mar 27 15:49:33 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_c99_init.c,v 1.13 2021/03/23 23:12:21 rillig Exp $   */
+/*     $NetBSD: d_c99_init.c,v 1.14 2021/03/27 15:49:33 rillig Exp $   */
 # 3 "d_c99_init.c"
 
 /*
@@ -176,4 +176,33 @@
        }
 };
 
+
+struct triangle {
+       struct point points[3];
+};
+
+struct pentagon {
+       struct point points[5];
+};
+
+struct geometry {
+       struct pentagon pentagons[6];
+       struct triangle triangles[10];
+       struct point points[3][5][2];
+};
+
+/*
+ * Initialization of a complex struct containing nested arrays and nested
+ * structs.
+ */
+struct geometry geometry = {
+    // FIXME: assertion "istk->i_type != NULL" failed in initstack_push
+    //.pentagons[0].points[4].x = 1,
+    .points[0][0][0] = { 0, 0 },
+    .points[2][4][1] = {301, 302 },
+    .points[3][0][0] = {3001, 3002 },
+    .points[0][5][0] = {501, 502 },
+    .points[0][0][2] = {21, 22 },
+};
+
 // See d_struct_init_nested.c for a more complicated example.



Home | Main Index | Thread Index | Old Index