You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
reinterpret of a pointer sum to an integer has no mode that runs it: the interpreter throws an internal binding error on i_das_ptr_add, and -jit fails codegen with Trunc only operates on integer for the 32-bit form #4108
daslang 0.6.4 at master 237df6024, Linux x86_64 (WSL2, kernel 6.6), gcc 11.4, Release, LLVM 22.1.5 prebuilt.
reinterpret<uint64>(...) or reinterpret<uint>(...) applied directly to the result of pointer arithmetic (p + n, p - n) compiles, and then has no mode that runs it. The interpreter throws an internal binding error from the reinterpret node; -jit fails LLVM codegen for the 32-bit form. Storing the sum in a variable first and reinterpreting the variable works everywhere, so the operation itself is supported - only the direct spelling is broken.
sum32.das, the same with reinterpret<uint> on both lines:
$ daslang sum32.das
EXCEPTION: internal binding error: typed eval on wrong extern return kind, i_das_ptr_add
$ daslang -jit sum32.das
Trunc only operates on integer
%trunc_cast = trunc ptr %19 to i32
failed to simulate
With let q : uint8? = unsafe(p + 4) and reinterpret<uint64>(q) both modes print 0x4. The pointee type (uint8?, int?, float?), the offset spelling (p + 4, p + n, p - 4) and -no-optimization do not change the result.
Expected
Both spellings behave like the through-a-variable form: the interpreter prints the address, and -jit produces the low 32 bits for reinterpret<uint>. If a 32-bit reinterpret of a pointer is meant to be rejected, a compile-time error is the right place; a verifier failure inside codegen and a run-time internal binding error are not.
Where
Interpreter: the message is ext_wrong_slot (include/daScript/simulate/interop.h). i_das_ptr_add is an extern returning a pointer, and the reinterpret node reads its result through the evalUInt64 / evalUInt slot, which ext_slot_cast does not accept for a pointer carrier.
JIT: the emitter builds trunc ptr -> i32 directly on the pointer value; LLVM requires ptrtoint first.
Test
Drops into tests/jit_tests/ (or tests/language/); on master the interpreter reports two errors and -jit fails the file at codegen.
Fixed on master: at abf1d40e35 the repro prints u64 0x4 / u32 0x4 in the interpreter and under -jit, and the test above passes on both tiers (f04c0ed and the #4480 batch). Closing.
Activity
jit: a pointer reinterprets to any integer width through ptrtoint
jit: a pointer reinterprets to any integer width through ptrtoint
jit: a pointer reinterprets to any integer width through ptrtoint
jit: a pointer reinterprets to any integer width through ptrtoint
jit: a pointer reinterprets to any integer width through ptrtoint
dasLLVM: bool and pointer reinterprets, default<T[N]>, try/recover re…
dasLLVM: bool and pointer reinterprets, default<T[N]>, try/recover re…
borisbat commentedon Nov 7, 2026
Both halves are in: #4472 (dasLLVM) and #4480 (the optimizer and front end). Closing.
lookibed commentedon Nov 9, 2026
Fixed on master: at
abf1d40e35the repro printsu64 0x4/u32 0x4in the interpreter and under-jit, and the test above passes on both tiers (f04c0ed and the #4480 batch). Closing.