Skip to content

A failing assert in a Linux JIT run is reported, not a compiler crash - #396

Merged
ASDAlexander77 merged 1 commit into
mainfrom
jit-linux-assert-handler
Sep 28, 2026
Merged

ASDAlexander77 merged 1 commit into
mainfrom
jit-linux-assert-handler

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

Off Windows, a failing assert lowers to glibc's __assert_fail, which ends in abort(). Under --emit=jit that SIGABRT is raised inside tslang, so its crash handler took it for a compiler crash: after the message it printed "PLEASE submit a bug report" and a "Stack dump", and exited with 134.

printed before
tslang: :0: Assertion `n is 7' failed.
Stack dump without symbol names ...
7  libc.so.6 ... __assert_fail + 181
PLEASE submit a bug report to https://github.com/ASDAlexander77/TypeScriptCompiler/issues ...

The JIT now binds __assert_fail to the handler that already answers _assert on Windows (jitAssertFailed). It flushes stdout, prints [file:line: ]assertion failed: <msg>, and exits with 3, the same as on Windows:

printed before
assertion failed: n is 7

test-jit-assert-message-failing (added Windows-only in #393 because of this crash) now runs on every platform.

Tests: Linux (WSL) 3046/3046. Windows: tslang rebuilt, ctest -R assert 13/13. The only Windows change is the CMake if (WIN32) removal; the jit.cpp change is under #ifndef _WIN32.

🤖 Generated with Claude Code

Off Windows the lowered assert calls glibc's __assert_fail, which ends in
abort(). tslang's crash handler took that SIGABRT for a compiler crash
and printed "PLEASE submit a bug report" and a "Stack dump" after the
message. The JIT now binds __assert_fail to the handler that already
answers _assert on Windows: it prints "file:line: assertion failed: msg"
and exits with 3. The failing-assert JIT test runs on Linux too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit 2eddbb5 into main Sep 28, 2026
2 checks passed
@ASDAlexander77
ASDAlexander77 deleted the jit-linux-assert-handler branch September 28, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant