From 8f24804db0519fe5d573f79ab442efa741928549 Mon Sep 17 00:00:00 2001 From: rillig Date: Sat, 27 Mar 2021 15:49:33 +0000 Subject: [PATCH] tests/lint: trigger assertion failure in array initialization --- tests/usr.bin/xlint/lint1/d_c99_init.c | 31 +++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/tests/usr.bin/xlint/lint1/d_c99_init.c b/tests/usr.bin/xlint/lint1/d_c99_init.c index 211fb6a81a5a..97a4ac0a5e52 100644 --- a/tests/usr.bin/xlint/lint1/d_c99_init.c +++ b/tests/usr.bin/xlint/lint1/d_c99_init.c @@ -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 point points[] = { } }; + +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.