fix #15117 zero size array cause incorrect codegen for VCC compiler (#21197)

fix #15117
This commit is contained in:
Bung 2022-12-30 07:50:12 +08:00 • committed by GitHub
commit c598d0b6ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 0 deletions

View file

@ -3331,6 +3331,8 @@ proc genConstObjConstr(p: BProc; n: PNode; isConst: bool; result: var Rope) =
proc genConstSimpleList(p: BProc, n: PNode; isConst: bool; result: var Rope) =
result.add "{"
if p.vccAndC and n.len == 0 and n.typ.kind == tyArray:
getDefaultValue(p, n.typ[1], n.info, result)
for i in 0..<n.len:
let it = n[i]
if i > 0: result.add ",\n"