Skip to content

Commit 60a227b

Browse files
committed
memory/model: bugfix of array elem type
when creating locations for array slots, re-set the type of the field before each, as it may have changed...
1 parent 76b12db commit 60a227b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

memory/model.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,9 @@ func (mod *Model) p_add(gp *GenParams, p, r Loc, sum *int) Loc {
219219
*sum++
220220

221221
m := gp.ts.ArrayLen(gp.typ)
222-
gp.typ = gp.ts.Elem(gp.typ)
222+
elemTy := gp.ts.Elem(gp.typ)
223223
for i := 0; i < m; i++ {
224+
gp.typ = elemTy
224225
mod.p_add(gp, n, r, sum)
225226
}
226227
case typeset.Struct:

0 commit comments

Comments
 (0)