Repository navigation
TSLANG 226: -mm=own string in a tuple twice freed twice; fixes from the Debug-compiler suite - #1064
Merged
Merged
Conversation
…; fixes for the Debug-compiler suite
- -mm=own: `<[V, V]>[value, value]` yielded by a generator (two reads of its state's slot) and
`const p = <[string, string]>[s, s]` gave the tuple two owners of one string, and its release
gave it back twice: the program hung or crashed at exit (a Set's entries()). After the analysis
each repeat of a string in a tuple - the same value, or a read of the same place with nothing
stored between - is a copy of its own (copyRepeatedTupleStrings).
- Debug compiler, 153 of 10,139 tests failed on the rebuilt Debug LLVM:
- a generator's return() result literal had no source span (its `.obj` name from an empty one):
the body's span now; ~80 generator tests stopped on `loc_->pos != loc_->_end`;
- a cast of an interface, or of `null | V` of a @value V, to `null` reached castLLVMTypes'
"review usage": a value seen as `null` is the null pointer;
- a closure's function type had its captures compared with the other's first parameter: they are
skipped, as a receiver is;
- `const { 0: a } = t` called IntegerAttr::getInt() on an `si32` key;
- resolveModuleFile assigned a path its own parent, a view into itself (UB in Release too);
- `x.w ??= v` of a @weak field read its view after storing the right side erased it;
- `tsbindgen -o -` closed stdout, which its stream does not own.
Test 00tuple_repeated_string (all models).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TSLANG 226: a double free under
-mm=own, and fixes from running the suite on a Debug compiler.-mm=own
<[V, V]>[value, value]yielded by a generator (it reads its state's slot twice) andconst p = <[string, string]>[s, s]gave the tuple two owners of one string, and releasing the tuple gave it back twice: the program hung or crashed at exit. This is how aSet.entries()returning[v, v]crashed. Each repeat of a string in a tuple, whether the same value or a read of the same place, now gets its own copy after the analysis. An object given twice is still refused, as a use after its move.Debug compiler (153 of 10,139 tests failed once the local Debug LLVM was rebuilt with the current MSVC)
return()result literal had no source span, so its storage name came from an empty one. About 80 generator tests stopped onloc_->pos != loc_->_end. It now takes the body's span.null | Vfor a@valuetypeV, tonullreachedcastLLVMTypes' "review usage" stop (class_to_interface_null,value_missing_niche). A value seen asnullis now the null pointer.generic_arrow_any). It is now skipped, as a receiver is.const { 0: a } = tcalledIntegerAttr::getInt()on ansi32key (declarationsAndAssignments).resolveModuleFileassigned a path its own parent, which is a view into itself (ambient_module_import). That is undefined behaviour in Release too.x.w ??= von a@weakfield read its view after storing the right side had erased it (own_weak_field_logical).tsbindgen -o -closed stdout, which its stream does not own (LLVM'sShouldCloseassert).Rerun by name on the Debug compiler, 139 of the 153 pass. Still open:
own_counted_list_cut_in_stepcrashes under a Debug compiler's JIT, though its exe and the Release compiler's JIT print the right result.Also
Map.entries()yields[k, v], andSet.entries()yields[v, v].catchand afinallythat awaits was re-checked and is not a leak: memory rises in 32 MB allocator steps and falls back during the run.Validation
00tuple_repeated_stringin all four models. It segfaults under own with the previous compiler.🤖 Generated with Claude Code