Consider empty structs to be of size 1.

This commit is contained in:
cfreksen 2017-11-09 14:37:40 +01:00
parent bef14dfa24
commit 8afdf563b3
No known key found for this signature in database
GPG Key ID: EAC13EE101008978
1 changed files with 1 additions and 1 deletions

View File

@ -486,7 +486,7 @@ def base_ty2size(base_ty):
elif isinstance(base_ty, ll.PointerType):
return 1
elif isinstance(base_ty, ll.StructType):
return sum(map(base_ty2size, base_ty.fields))
return max(1, sum(map(base_ty2size, base_ty.fields)))
else:
# TODO
err('base_ty2size: Unknown type or illegal type: {}'