bitsize respected in size calculation. (#9756)

This commit is contained in:
Arne Döring 2018-11-19 13:48:40 +01:00 • committed by Andreas Rumpf
commit 1e08fff2d5
3 changed files with 42 additions and 7 deletions

View file

@ -127,9 +127,14 @@ proc computeObjectOffsetsFoldFunction(conf: ConfigRef; n: PNode, initialOffset:
result.offset = align(offset, result.align)
of nkSym:
computeSizeAlign(conf, n.sym.typ)
let size = n.sym.typ.size
let align = n.sym.typ.align
var size = szUnknownSize
var align = szUnknownSize
if n.sym.bitsize == 0: # 0 represents bitsize not set
computeSizeAlign(conf, n.sym.typ)
size = n.sym.typ.size.int
align = n.sym.typ.align.int
result.align = align
if initialOffset == szUnknownSize or size == szUnknownSize:
n.sym.offset = szUnknownSize