const_convert_type catches the ValueError that int() raises for NaN but not the OverflowError it raises for infinity, so casting a non-finite constant to any integer type escapes as an uncaught Python exception. An infinite constant is easy to produce today because out-of-range float constants fold to inf (#110), and the crash fires in every position that coerces the cast: assignments, command arguments, array indices, range bounds, exit and assert codes. Both backends crash with a traceback; the NaN variant of the same casts correctly reports For type F64: cannot convert float NaN to integer.
x: I64 = I64(F64(1e999)) # OverflowError: cannot convert float infinity to integer
y: U8 = U8(F64(1e999)) # same
CdhCore.cmdDisp.CMD_TEST_CMD_1(I32(F64(1e999)), 1.0, 1) # same
for i in 0..I64(F64(1e999)): # same
pass
const_convert_typecatches theValueErrorthatint()raises for NaN but not theOverflowErrorit raises for infinity, so casting a non-finite constant to any integer type escapes as an uncaught Python exception. An infinite constant is easy to produce today because out-of-range float constants fold toinf(#110), and the crash fires in every position that coerces the cast: assignments, command arguments, array indices, range bounds,exitandassertcodes. Both backends crash with a traceback; the NaN variant of the same casts correctly reportsFor type F64: cannot convert float NaN to integer.