Skip to content

Commit 4454ac4

Browse files
committed
- forcing the alignment for structure in array if not a multiple at least of 4
get a case with one winapi function (createacceleratortable) not working
1 parent 4317d7c commit 4454ac4

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/compiler/ir-gas64.bas

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,7 +1921,7 @@ end sub
19211921
#endif
19221922

19231923
private sub hemitvariable( byval sym as FBSYMBOL ptr )
1924-
dim as integer is_global = any, length = any,lgt=any
1924+
dim as integer is_global = any, length = any,lgt=any,align=any
19251925
dim as string strg,newstrg
19261926
dim as long pnew,pold,lenstrg
19271927
asm_info(*symbgetname(sym)+ " "+*symbGetMangledName(sym))
@@ -2013,8 +2013,13 @@ private sub hemitvariable( byval sym as FBSYMBOL ptr )
20132013
asm_info("var total size="+Str(length))
20142014
asm_info("stk="+Str(ctx.stk))
20152015
if symbGetType( sym )=FB_DATATYPE_STRUCT then
2016-
asm_info("length udt="+Str(sym->lgt)+" natalign="+Str(sym->subtype->udt.natalign)+" unpadlgt="+Str(sym->subtype->udt.unpadlgt))
2017-
ctx.stk=(length+ctx.stk+sym->subtype->udt.natalign-1) And (Not(sym->subtype->udt.natalign-1))
2016+
align=sym->subtype->udt.natalign
2017+
asm_info("length udt="+Str(sym->lgt)+" natalign="+Str(align)+" unpadlgt="+Str(sym->subtype->udt.unpadlgt))
2018+
if align<4 then
2019+
asm_info("Natalign= changed for 4")
2020+
align=4 ''alignment at least 4"
2021+
end if
2022+
ctx.stk=(length+ctx.stk+align-1) And (Not(align-1))
20182023
else
20192024
ctx.stk=(length+ctx.stk+lgt-1) And (Not(lgt-1))
20202025
end if

0 commit comments

Comments
 (0)