LLVM could theoretically detect that this array iteration bound is invalid, and generate illegal loads here, since the information passed to unsafe_wrap is not valid (the max possible legal size here is also typemax(Int)/sizeof(Int), though that still would trigger UB)
|
function listallplots(nplots=Int(maxintfloat())) |
. Using
maxintfloat is even more of an issue here because (a) Float is not involved anywhere (b) On 32-bit, that would correspond to exactly
typemax, but that is not larger than the representable maximum value that is legal.
It is not particularly clear why it would decide to try to vectorize this code, since unsafe_string is already expensive there, but formally this array size could trigger UB since it aliases other memory and points to memory that is undefined.
LLVM could theoretically detect that this array iteration bound is invalid, and generate illegal loads here, since the information passed to
unsafe_wrapis not valid (the max possible legal size here is alsotypemax(Int)/sizeof(Int), though that still would trigger UB)NgSpice.jl/src/API/get_vector.jl
Line 54 in b56aece
maxintfloatis even more of an issue here because (a) Float is not involved anywhere (b) On 32-bit, that would correspond to exactlytypemax, but that is not larger than the representable maximum value that is legal.It is not particularly clear why it would decide to try to vectorize this code, since
unsafe_stringis already expensive there, but formally this array size could trigger UB since it aliases other memory and points to memory that is undefined.