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

@ -1062,6 +1062,8 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
invalidPragma(c, it)
else:
sym.bitsize = expectIntLit(c, it)
if sym.bitsize <= 0:
localError(c.config, it.info, "bitsize needs to be positive")
of wGuard:
if sym == nil or sym.kind notin {skVar, skLet, skField}:
invalidPragma(c, it)