summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorslangmgh <37659406+slangmgh@users.noreply.github.com>2020-01-19 21:16:50 +0800
committerAndreas Rumpf <rumpf_a@web.de>2020-01-19 14:16:50 +0100
commit13ddbc46fc255978ebaf4233009b44db29583cb4 (patch)
treec15758a29a9bfb3e50715a6ee9f557199e6ac1fd
parent8d64550b1e098149883e3509153226c404a11e02 (diff)
downloadNim-13ddbc46fc255978ebaf4233009b44db29583cb4.tar.gz
Fixes #13186 (#13188)
-rw-r--r--compiler/ccgstmts.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim
index ec13b991d..b9e26789f 100644
--- a/compiler/ccgstmts.nim
+++ b/compiler/ccgstmts.nim
@@ -1041,7 +1041,8 @@ proc genTryGoto(p: BProc; t: PNode; d: var TLoc) =
   p.nestedTryStmts.add((fin, false, Natural lab))
 
   p.flags.incl nimErrorFlagAccessed
-  linefmt(p, cpsStmts, "NI oldNimErr$1_ = *nimErr_; *nimErr_ = 0;;$n", [lab])
+  p.procSec(cpsLocals).add(ropecg(p.module, "NI oldNimErr$1_;$n", [lab]))
+  linefmt(p, cpsStmts, "oldNimErr$1_ = *nimErr_; *nimErr_ = 0;;$n", [lab])
 
   expr(p, t[0], d)
 
@@ -1104,7 +1105,8 @@ proc genTryGoto(p: BProc; t: PNode; d: var TLoc) =
       genStmts(p, t[i][0])
     else:
       # pretend we did handle the error for the safe execution of the 'finally' section:
-      linefmt(p, cpsStmts, "NI oldNimErrFin$1_ = *nimErr_; *nimErr_ = 0;$n", [lab])
+      p.procSec(cpsLocals).add(ropecg(p.module, "NI oldNimErrFin$1_;$n", [lab]))
+      linefmt(p, cpsStmts, "oldNimErrFin$1_ = *nimErr_; *nimErr_ = 0;$n", [lab])
       genStmts(p, t[i][0])
       # this is correct for all these cases:
       # 1. finally is run during ordinary control flow