>From 62c5b02b46c7c7b23a54d6aa1c1316c620d6b370 Mon Sep 17 00:00:00 2001 From: Mart Gerrits Date: Sun, 15 Apr 2018 19:20:32 +0200 Subject: [PATCH 2/2] x86-64: expand bool return values to int for PE target --- x86_64-gen.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x86_64-gen.c b/x86_64-gen.c index 199a74f..44cb70c 100644 --- a/x86_64-gen.c +++ b/x86_64-gen.c @@ -927,10 +927,12 @@ void gfunc_call(int nb_args) o(0x0548), gen_le32(func_alloca), func_alloca = ind - 4; } - /* other compilers don't clear the upper bits when returning char/short */ + /* other compilers don't clear the upper bits when returning bool/char/short */ bt = vtop->type.ref->type.t & (VT_BTYPE | VT_UNSIGNED); if (bt == (VT_BYTE | VT_UNSIGNED)) o(0xc0b60f); /* movzbl %al, %eax */ + else if(bt == VT_BOOL) + o(0xc0b60f); /* movzbl %al, %eax */ else if (bt == VT_BYTE) o(0xc0be0f); /* movsbl %al, %eax */ else if (bt == VT_SHORT) -- 2.16.3