test/800: pin >6-element 32B-struct append growth (#34 review, getopt OOB shape)
getopt's deleted appendoption helper fed rt_ensure a hardcoded
membsz=24, stale since str went 24B (option {rune,str} = 32B): the
8-slot first grow allocated 192B while writes strode 32 — OOB past 6
options. The builtin derives 32 from the type table (MOVQ $32, SI);
this row appends 8 option literals and reads element 7 back full-width
so the class stays pinned. No in-tree test parsed >3 options.
This commit is contained in:
@@ -63,6 +63,15 @@
|
||||
* tagged_ident_src | append of ALREADY-TAGGED locals | 42
|
||||
* | (i64 + bool members) — the widener's |
|
||||
* | already-tagged source path. |
|
||||
* struct_eight_appends | 8 struct-lit appends of the getopt | 15
|
||||
* | option shape ({rune,str} = 32B), |
|
||||
* | full-width readback of element 7 — |
|
||||
* | the >6-element OOB regression pin |
|
||||
* | (getopt's deleted helper fed a stale |
|
||||
* | hardcoded membsz=24: 8-slot grow was |
|
||||
* | 192B while writes strode 32; the |
|
||||
* | builtin derives 32 from the type |
|
||||
* | table, MOVQ $32, SI). |
|
||||
* struct_call_loudstop | append(xs, f()) struct-from-call is | BUILD_FAIL
|
||||
* | the deferred source shape — must |
|
||||
* | fail LOUD on both stages (rule-7), |
|
||||
@@ -281,6 +290,23 @@ static const struct row rows[] = {
|
||||
"};\n",
|
||||
42 },
|
||||
|
||||
{ "struct_eight_appends",
|
||||
"package main;\n"
|
||||
"type option = struct { flag: rune, value: str };\n"
|
||||
"export fn main() i32 = {\n"
|
||||
"\tlet opts: []option = [];\n"
|
||||
"\tappend(opts, option { flag = 'a', value = \"v0\" });\n"
|
||||
"\tappend(opts, option { flag = 'b', value = \"v1\" });\n"
|
||||
"\tappend(opts, option { flag = 'c', value = \"v2\" });\n"
|
||||
"\tappend(opts, option { flag = 'd', value = \"v3\" });\n"
|
||||
"\tappend(opts, option { flag = 'e', value = \"v4\" });\n"
|
||||
"\tappend(opts, option { flag = 'f', value = \"v5\" });\n"
|
||||
"\tappend(opts, option { flag = 'g', value = \"v6\" });\n"
|
||||
"\tappend(opts, option { flag = 'h', value = \"seventh\" });\n"
|
||||
"\treturn (opts[7].value.len + opts.len): i32;\n"
|
||||
"};\n",
|
||||
15 },
|
||||
|
||||
{ "struct_call_loudstop",
|
||||
"package main;\n"
|
||||
"type pt = struct { x: i32, y: i32, z: i64 };\n"
|
||||
|
||||
Reference in New Issue
Block a user