summary refs log tree commit diff stats
path: root/compiler/cgen.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-02-27 20:39:34 +0100
committerAraq <rumpf_a@web.de>2014-02-27 20:39:34 +0100
commit2f692dcc3ae8820969e61ab86f6f29fe33308e91 (patch)
tree9dd6bbc15adec25e4f3c8b2990929e5b4dae66ad /compiler/cgen.nim
parente1600f209fd5a2e152f0ff556c10e097e5bec256 (diff)
downloadNim-2f692dcc3ae8820969e61ab86f6f29fe33308e91.tar.gz
make C backend more robust against compiler bugs
Diffstat (limited to 'compiler/cgen.nim')
-rw-r--r--compiler/cgen.nim2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim
index 87ed23f36..8da753d04 100644
--- a/compiler/cgen.nim
+++ b/compiler/cgen.nim
@@ -761,6 +761,8 @@ proc genProcAux(m: BModule, prc: PSym) =
   var returnStmt: PRope = nil
   assert(prc.ast != nil)
   if sfPure notin prc.flags and prc.typ.sons[0] != nil:
+    if resultPos >= prc.ast.len:
+      internalError(prc.info, "proc has no result symbol")
     var res = prc.ast.sons[resultPos].sym # get result symbol
     if not isInvalidReturnType(prc.typ.sons[0]):
       if sfNoInit in prc.flags: incl(res.flags, sfNoInit)