From 90ae383f62c2b211de7122c735ec47cba99db9ec Mon Sep 17 00:00:00 2001 From: kbkpbot Date: Thu, 26 Dec 2024 12:30:07 +0800 Subject: [PATCH] x86_64/i386: Add missing fetch CPU flag In x86_64-gen.c/i386-gen.c, gfunc_call will generate structure store for bt == VT_STRUCT. Before generating any code, it is needed fetch cpu flag. As #ifdef TCC_TARGET_PE, gfunc_call() forgot to do this. --- i386-gen.c | 6 +++--- x86_64-gen.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/i386-gen.c b/i386-gen.c index ad71c301..1d521160 100644 --- a/i386-gen.c +++ b/i386-gen.c @@ -409,9 +409,9 @@ ST_FUNC void gfunc_call(int nb_args) args_size = 0; for(i = 0;i < nb_args; i++) { if ((vtop->type.t & VT_BTYPE) == VT_STRUCT) { - /* fetch cpu flag before generating any code */ - if ((vtop->r & VT_VALMASK) == VT_CMP) - gv(RC_INT); + /* fetch cpu flag before generating any code */ + if ((vtop->r & VT_VALMASK) == VT_CMP) + gv(RC_INT); size = type_size(&vtop->type, &align); /* align to stack align size */ size = (size + 3) & ~3; diff --git a/x86_64-gen.c b/x86_64-gen.c index fe239273..29a83069 100644 --- a/x86_64-gen.c +++ b/x86_64-gen.c @@ -828,10 +828,10 @@ void gfunc_call(int nb_args) continue; /* arguments smaller than 8 bytes passed in registers or on stack */ if (bt == VT_STRUCT) { - /* fetch cpu flag before generating any code */ - if ((vtop->r & VT_VALMASK) == VT_CMP) - gv(RC_INT); - /* align to stack align size */ + /* fetch cpu flag before generating any code */ + if ((vtop->r & VT_VALMASK) == VT_CMP) + gv(RC_INT); + /* align to stack align size */ size = (size + 15) & ~15; /* generate structure store */ r = get_reg(RC_INT);