diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim index ca6e51f29a..82f1caadc0 100644 --- a/compiler/ccgstmts.nim +++ b/compiler/ccgstmts.nim @@ -688,14 +688,15 @@ proc genBreakStmt(p: BProc, t: PNode) = proc raiseExit(p: BProc) = assert p.config.exc == excGoto - p.flags.incl nimErrorFlagAccessed - if p.nestedTryStmts.len == 0: - p.flags.incl beforeRetNeeded - # easy case, simply goto 'ret': - lineCg(p, cpsStmts, "if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;$n", []) - else: - lineCg(p, cpsStmts, "if (NIM_UNLIKELY(*nimErr_)) goto LA$1_;$n", - [p.nestedTryStmts[^1].label]) + if nimErrorFlagDisabled notin p.flags: + p.flags.incl nimErrorFlagAccessed + if p.nestedTryStmts.len == 0: + p.flags.incl beforeRetNeeded + # easy case, simply goto 'ret': + lineCg(p, cpsStmts, "if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;$n", []) + else: + lineCg(p, cpsStmts, "if (NIM_UNLIKELY(*nimErr_)) goto LA$1_;$n", + [p.nestedTryStmts[^1].label]) proc finallyActions(p: BProc) = if p.config.exc != excGoto and p.nestedTryStmts.len > 0 and p.nestedTryStmts[^1].inExcept: diff --git a/compiler/cgen.nim b/compiler/cgen.nim index 417acf1786..cd02ba9b11 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -682,6 +682,7 @@ proc loadDynamicLib(m: BModule, lib: PLib) = else: var p = newProc(nil, m) p.options = p.options - {optStackTrace} + p.flags.incl nimErrorFlagDisabled var dest: TLoc initLoc(dest, locTemp, lib.path, OnStack) dest.r = getTempName(m) diff --git a/compiler/cgendata.nim b/compiler/cgendata.nim index 96e3828739..ce74963e22 100644 --- a/compiler/cgendata.nim +++ b/compiler/cgendata.nim @@ -70,7 +70,8 @@ type hasCurFramePointer, noSafePoints, nimErrorFlagAccessed, - nimErrorFlagDeclared + nimErrorFlagDeclared, + nimErrorFlagDisabled TCProc = object # represents C proc that is currently generated prc*: PSym # the Nim proc that this C proc belongs to