summary refs log tree commit diff stats
path: root/compiler/pragmas.nim
diff options
context:
space:
mode:
authorArne Döring <arne.doering@gmx.net>2018-11-19 13:48:40 +0100
committerAndreas Rumpf <rumpf_a@web.de>2018-11-19 13:48:40 +0100
commit1e08fff2d525e4c2db68a92819fb910739252764 (patch)
treeea791b12901a3e50ebe477d1cb4f60b4bde7725e /compiler/pragmas.nim
parent2418d0cac50642131d2b3350ededf2b3a1bd2b1d (diff)
downloadNim-1e08fff2d525e4c2db68a92819fb910739252764.tar.gz
bitsize respected in size calculation. (#9756)
Diffstat (limited to 'compiler/pragmas.nim')
-rw-r--r--compiler/pragmas.nim2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim
index 1c07a3309..ef5223559 100644
--- a/compiler/pragmas.nim
+++ b/compiler/pragmas.nim
@@ -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)