Skip to content

Commit

Permalink
x86_64/i386: Add missing fetch CPU flag
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kbkpbot committed Dec 26, 2024
1 parent af1cfd9 commit 90ae383
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions i386-gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions x86_64-gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 90ae383

Please sign in to comment.