From 8afdf563b3b65f2ce59c6e94eadeb6102762f76f Mon Sep 17 00:00:00 2001 From: cfreksen Date: Thu, 9 Nov 2017 14:37:40 +0100 Subject: [PATCH] Consider empty structs to be of size 1. --- llvm_emulator/stepper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm_emulator/stepper.py b/llvm_emulator/stepper.py index aeb641d..8a89db1 100644 --- a/llvm_emulator/stepper.py +++ b/llvm_emulator/stepper.py @@ -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: {}'