summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/vmgen.nim2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim
index fd0c3fc69..adbca8cca 100644
--- a/compiler/vmgen.nim
+++ b/compiler/vmgen.nim
@@ -1093,6 +1093,8 @@ proc setSlot(c: PCtx; v: PSym) =
   # XXX generate type initialization here?
   if v.position == 0:
     if c.prc.maxSlots == 0: c.prc.maxSlots = 1
+    if c.prc.maxSlots >= high(TRegister):
+      internalError(v.info, "cannot generate code; too many registers required")
     v.position = c.prc.maxSlots
     c.prc.slots[v.position] = (inUse: true,
         kind: if v.kind == skLet: slotFixedLet else: slotFixedVar)