Repository navigation
json_index.ts: readByKey/writeByKey, not read/write (Linux -mm=gc segfault) - #88
Merged
Merged
Conversation
…fault) A program's functions are global symbols. On Linux the test's read() took the place of libc's, which libgc calls from GC_get_nprocs when it starts, so the compiled exe segfaulted under -mm=gc (release and debug; the JIT was fine). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ASDAlexander77
added a commit
that referenced
this pull request
Nov 9, 2026
The Testing section now shows how to run the tests under one memory model (tests.ps1 -Model, tests.sh <model>, TSLANG_MM), the first-line markers that skip a test (// gc only, // not own, // linux only), and that a test function named like a libc function (read, write) replaces it on Linux, which made a test segfault under -mm=gc (#88). 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.
Fixes the alpha121 release failure in Test Default Library (ubuntu-*, -mm=gc):
release/compileanddebug/compileofjson_index.tsprinted nothing.Cause. A program's functions are global symbols, which keeps C-style linking (the ruling from TypeScriptCompiler #793). The test defined
function read(value: JsonValue). In a compiled Linux exe that function took the place of libc'sread(). libgc callsread()fromGC_get_nprocsduringGC_init, so the program segfaulted beforemain:The JIT and rc/none/own were not affected.
write()is another libc name, so it is renamed too.Checked with the CI alpha121 ubuntu-26.04 package in WSL:
json_index.tsnow prints ALL DONE as a compiled exe under gc (release and--di --opt_level=0), rc and none.Other test functions with libc/libm names:
declare_read_write.tsdeclares libc's read/write on purpose.range_error_caught.tshasremainder(libm), which nothing in the runtime calls, so it is left as is.🤖 Generated with Claude Code