This page documents current compiler bugs, codegen limitations, and workarounds.
The frozen bootstrap compiler has several known issues:
| Issue | Workaround |
|---|---|
| No generic class methods with receiver type inference | Use free functions or explicit type parameters |
| Float function parameters broken | Inline the computation instead |
% modulo operator broken |
Use a - (a / b) * b |
| Boolean variables broken | Use var x = 0; x = 1; if x == 1 { |
if/else if chains broken |
Use nested if/else blocks |
if not X broken |
Use if X { return } + fall-through |
.getTokenType() cross-module issue |
Use checkToken(SeenTokenType.X) |
The current compiler source now has regression coverage for several patterns that were previously listed here as active production codegen bugs:
static fun in classesvar x = func()Array<T> / String initializationArray<T> via r: syntaxlet bindings of string expressions inside while loops"{identifier"Compilers built from the refactored source hang on 12 specific modules (0, 3, 5, 9, 10, 11, 12, 14, 16, 23, 25, 35) when compiling from scratch without IR cache.
Impact: Cannot cold-compile the full compiler with the refactored-source compiler.
Workaround: Use the pre-refactoring compiler (stored as stage1_frozen) to populate the IR cache. The safe_rebuild.sh script handles this automatically.
Note: This is NOT fork-related. The hang occurs with --no-fork as well.
getelementptr %ClassName in module X fails if %ClassName is defined in module Y.
Workaround: Use memset zero-init instead of per-field GEP in isClassType() constructor path.
extern fun __foo() RuleNames starting with __ with an empty body are skipped by codegen.
Workaround: Add explicit declare entry to ir_declarations.seen.
SSA registers must be strictly ascending. Pre-allocate the register for the FIRST instruction.
!invariant.load on array data pointers is incorrect -- data changes on push/resize. Do not mark array data as invariant.
Do not stack-allocate SeenArray headers. Escaping pointers will crash. Always heap-allocate.
Runtime C functions returning 0/1 int64_t for bool need trunc i64 to i1 in codegen.
isNaN/isInfinite ChecksMust NOT use fast flag (fast implies nnan/ninf).
HashMap iteration order is non-deterministic. In --deterministic mode, the compiler rejects HashMap usage unless marked with @nondeterministic.
If you encounter a new bug:
repro_*.seen)--emit-llvm to inspect generated IRSEEN_TRACE_LLVM=all for detailed tracing