Indexing a raw pointer with an int64 index compiles and runs fine in interpreter and JIT, but the AOT-generated C++ fails to compile:
error: call to 'at' is ambiguous
das_index<float * const >::at(__rp, __i, __context__)
note: candidate: at ( TT * value, int32_t index, Context * ) // aot.h:891
note: candidate: at ( TT * value, uint32_t index, Context * ) // aot.h:894
int64_t converts to int32_t and uint32_t with equal rank, so clang rejects the call.
Minimal repro (any .das through the AOT emitter):
options gen2
def touch(p : float?; n : int64) : float {
var s = 0.0
unsafe {
for (i in range64(n)) {
s += p[i] // AOT: ambiguous
}
}
return s
}
Root cause: the das_index<TT * const> specialization in include/daScript/simulate/aot.h (~line 890) only provides int32_t / uint32_t overloads for at and safe_at. Arrays are not affected — array<T> indexing has 64-bit overloads — it is only raw pointers.
Suggested fix: add int64_t / uint64_t overloads to at and safe_at in the pointer specializations (additive, no ABI concern). Until then the das-side workaround is an int loop or an int(i) cast at the index site.
Hit in practice by diff_stage in modules/dasLLAMA/dasllama/dasllama_audio.das (worked around in #3390, commit 5c412f4); trap documented in skills/aot_testing.md.
Indexing a raw pointer with an
int64index compiles and runs fine in interpreter and JIT, but the AOT-generated C++ fails to compile:int64_tconverts toint32_tanduint32_twith equal rank, so clang rejects the call.Minimal repro (any
.dasthrough the AOT emitter):Root cause: the
das_index<TT * const>specialization ininclude/daScript/simulate/aot.h(~line 890) only providesint32_t/uint32_toverloads foratandsafe_at. Arrays are not affected —array<T>indexing has 64-bit overloads — it is only raw pointers.Suggested fix: add
int64_t/uint64_toverloads toatandsafe_atin the pointer specializations (additive, no ABI concern). Until then the das-side workaround is an int loop or anint(i)cast at the index site.Hit in practice by
diff_stageinmodules/dasLLAMA/dasllama/dasllama_audio.das(worked around in #3390, commit 5c412f4); trap documented inskills/aot_testing.md.