diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index f1e31b7f7e..6b757b5f85 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -1644,6 +1644,9 @@ proc trackProc*(c: PContext; s: PSym, body: PNode) = s.kind in {skProc, skFunc, skConverter, skMethod}: var res = s.ast[resultPos].sym # get result symbol t.scopes[res.id] = t.currentBlock + if sfNoInit in s.flags: + # marks result "noinit" + incl res.flags, sfNoInit track(t, body) @@ -1662,7 +1665,8 @@ proc trackProc*(c: PContext; s: PSym, body: PNode) = if not isEmptyType(s.typ.returnType) and (s.typ.returnType.requiresInit or s.typ.returnType.skipTypes(abstractInst).kind == tyVar or noStrictDefs notin c.config.legacyFeatures) and - s.kind in {skProc, skFunc, skConverter, skMethod} and s.magic == mNone: + s.kind in {skProc, skFunc, skConverter, skMethod} and s.magic == mNone and + sfNoInit notin s.flags: var res = s.ast[resultPos].sym # get result symbol if res.id notin t.init and breaksBlock(body) != bsNoReturn: if tfRequiresInit in s.typ.returnType.flags: diff --git a/lib/pure/volatile.nim b/lib/pure/volatile.nim index 0b79b61015..a38247c7db 100644 --- a/lib/pure/volatile.nim +++ b/lib/pure/volatile.nim @@ -19,7 +19,6 @@ proc volatileLoad*[T](src: ptr T): T {.inline, noinit.} = when defined(js): result = src[] else: - result = default(T) {.emit: [result, " = (*(", typeof(src[]), " volatile*)", src, ");"].} proc volatileStore*[T](dest: ptr T, val: T) {.inline.} =