* remove unnecessary when statement * remove outdated codes * attempt to fix #16374 * fix
This commit is contained in:
parent
ab780f66ef
commit
5628cd5de1
2 changed files with 44 additions and 1 deletions
|
|
@ -406,6 +406,11 @@ proc resetLoc(p: BProc, loc: var TLoc) =
|
||||||
if isImportedCppType(typ): return
|
if isImportedCppType(typ): return
|
||||||
if optSeqDestructors in p.config.globalOptions and typ.kind in {tyString, tySequence}:
|
if optSeqDestructors in p.config.globalOptions and typ.kind in {tyString, tySequence}:
|
||||||
assert rdLoc(loc) != nil
|
assert rdLoc(loc) != nil
|
||||||
|
|
||||||
|
let atyp = skipTypes(loc.t, abstractInst)
|
||||||
|
if atyp.kind in {tyVar, tyLent}:
|
||||||
|
linefmt(p, cpsStmts, "$1->len = 0; $1->p = NIM_NIL;$n", [rdLoc(loc)])
|
||||||
|
else:
|
||||||
linefmt(p, cpsStmts, "$1.len = 0; $1.p = NIM_NIL;$n", [rdLoc(loc)])
|
linefmt(p, cpsStmts, "$1.len = 0; $1.p = NIM_NIL;$n", [rdLoc(loc)])
|
||||||
elif not isComplexValueType(typ):
|
elif not isComplexValueType(typ):
|
||||||
if containsGcRef:
|
if containsGcRef:
|
||||||
|
|
|
||||||
38
tests/ccgbugs/t16374.nim
Normal file
38
tests/ccgbugs/t16374.nim
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
discard """
|
||||||
|
matrix: "--gc:refc; --gc:orc"
|
||||||
|
"""
|
||||||
|
|
||||||
|
block:
|
||||||
|
iterator mvalues(t: var seq[seq[int]]): var seq[int] =
|
||||||
|
yield t[0]
|
||||||
|
|
||||||
|
var t: seq[seq[int]]
|
||||||
|
|
||||||
|
while false:
|
||||||
|
for v in t.mvalues:
|
||||||
|
discard
|
||||||
|
|
||||||
|
proc ok =
|
||||||
|
while false:
|
||||||
|
for v in t.mvalues:
|
||||||
|
discard
|
||||||
|
|
||||||
|
ok()
|
||||||
|
|
||||||
|
block:
|
||||||
|
iterator mvalues(t: var seq[seq[int]]): lent seq[int] =
|
||||||
|
yield t[0]
|
||||||
|
|
||||||
|
var t: seq[seq[int]]
|
||||||
|
|
||||||
|
while false:
|
||||||
|
for v in t.mvalues:
|
||||||
|
discard
|
||||||
|
|
||||||
|
proc ok =
|
||||||
|
while false:
|
||||||
|
for v in t.mvalues:
|
||||||
|
discard
|
||||||
|
|
||||||
|
ok()
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue