-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
TolkRelated to Tolk Language / compiler / toolingRelated to Tolk Language / compiler / toolingllm-fuzzing
Description
With -O2 (the default optimization level), compiling code that contains beginCell().storeInt(0, 256) crashes the compiler with an internal assertion failure in the optimizer. With -O1, the same code compiles successfully.
Reproduction
Create /tmp/tolk_storeint256_o2_crash.tolk:
tolk 1.0
fun onInternalMessage() { return 0; }
@method_id(100)
fun f(): int {
val c = beginCell().storeInt(0, 256).endCell();
return c.hash();
}
Compile with -O1 (works):
./artifacts/tolk -O1 /tmp/tolk_storeint256_o2_crash.tolk > /tmp/tolk_storeint256_o1.fifCompile with -O2 (crashes):
./artifacts/tolk -O2 /tmp/tolk_storeint256_o2_crash.tolk > /tmp/tolk_storeint256_o2.fifObserved output
The compiler crashes with:
fatal: Assertion failed at tolk/optimize.cpp:62: p_ > 0 && p_ <= l_ && q_ >= 0 && q_ <= optimize_depth && l_ <= optimize_depth
Expected behavior
-O2 should not crash on valid code. It should compile successfully (or emit a regular diagnostic), consistent with -O1.
Metadata
Metadata
Assignees
Labels
TolkRelated to Tolk Language / compiler / toolingRelated to Tolk Language / compiler / toolingllm-fuzzing