From 26f3dfff752c06cd445142759eeb394d775d2064 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Fri, 25 Aug 2023 02:56:58 +0800 Subject: [PATCH] fixes a strictdef ten years long vintage bug, which counts the same thing twice (#22549) fixes a strictdef ten years long vintage bug (cherry picked from commit 101337885459decedc9dc3301b1ff04cf8c54c32) --- compiler/ccgcalls.nim | 1 + compiler/semexprs.nim | 1 + compiler/sempass2.nim | 31 +++++++++++++++++++++---------- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/compiler/ccgcalls.nim b/compiler/ccgcalls.nim index dcada5d7c2..4430ddbba0 100644 --- a/compiler/ccgcalls.nim +++ b/compiler/ccgcalls.nim @@ -24,6 +24,7 @@ proc canRaiseDisp(p: BProc; n: PNode): bool = proc preventNrvo(p: BProc; dest, le, ri: PNode): bool = proc locationEscapes(p: BProc; le: PNode; inTryStmt: bool): bool = + result = false var n = le while true: # do NOT follow nkHiddenDeref here! diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 96c9573065..69ba3d7d2e 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -2139,6 +2139,7 @@ proc expectString(c: PContext, n: PNode): string = if n.kind in nkStrKinds: return n.strVal else: + result = "" localError(c.config, n.info, errStringLiteralExpected) proc newAnonSym(c: PContext; kind: TSymKind, info: TLineInfo): PSym = diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index 9747110471..bc415afacc 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -356,12 +356,15 @@ proc useVar(a: PEffects, n: PNode) = type TIntersection = seq[tuple[id, count: int]] # a simple count table -proc addToIntersection(inter: var TIntersection, s: int) = +proc addToIntersection(inter: var TIntersection, s: int, zeroInit: bool) = for j in 0..