Skip to content

Commit dfa482e

Browse files
authored
fixes #24770; Thread local not registed as GC root when =destroy exists (#24776)
fixes #24770 e.g. `seq[(ObjectWithDestructors, string)]`/ For refc, a seq with elements that have destructors will have `hasAsgn` flags. The flag is the criteria whether a seq is thought as `containsGarbageCollectedRef`. i.e. whether to `registerTraverseProc` for the type. The culprit seems to be that `searchTypeForAux` doesn't consider the element type of sequence, even it contains a string that should belong to `GarbageCollectedRef`. With this PR: It now generates ``` nimRegisterThreadLocalMarker(TM__mSF73dT1lSI7DG58StKHLQ_5); ``` in refc
1 parent 82891e6 commit dfa482e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/ccgstmts.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ proc registerTraverseProc(p: BProc, v: PSym) =
1818
var traverseProc = ""
1919
if p.config.selectedGC in {gcMarkAndSweep, gcHooks, gcRefc} and
2020
optOwnedRefs notin p.config.globalOptions and
21-
containsGarbageCollectedRef(v.loc.t):
21+
containsManagedMemory(v.loc.t):
2222
# we register a specialized marked proc here; this has the advantage
2323
# that it works out of the box for thread local storage then :-)
2424
traverseProc = genTraverseProcForGlobal(p.module, v, v.info)

0 commit comments

Comments
 (0)