Skip to content

Commit b6445e6

Browse files
authored
Correctly apply offset to tyconst in array size (#641)
The first quick fix for this used the wrong field names (missing `ArrayType` field before `size`).
1 parent b65361b commit b6445e6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kmir/src/kmir/linker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ def apply_offset_typeInfo(typeinfo: dict, offset: int) -> dict:
8080
typeinfo['UnionType']['adt_def'] = typeinfo['UnionType']['adt_def'] + offset
8181
elif 'ArrayType' in typeinfo:
8282
typeinfo['ArrayType']['elem_type'] = typeinfo['ArrayType']['elem_type'] + offset
83-
if 'size' in typeinfo:
84-
apply_offset_tyconst(typeinfo['size'], offset)
83+
if 'size' in typeinfo['ArrayType'] and typeinfo['ArrayType']['size'] is not None:
84+
apply_offset_tyconst(typeinfo['ArrayType']['size']['kind'], offset)
8585
elif 'PtrType' in typeinfo:
8686
typeinfo['PtrType']['pointee_type'] = typeinfo['PtrType']['pointee_type'] + offset
8787
elif 'RefType' in typeinfo:

0 commit comments

Comments
 (0)