The only other error Jeff and I can think of that isn’t modeled is StackOverflow. (The reasoning is that ~any code theoretically can throw those, and they don’t exist within the Turing machine model of a machine).
For your followup, see make `memorynew` intrinsic by oscardssmith · Pull Request #55913 · JuliaLang/julia · GitHub which does make foo4
removable (but isn’t quite able to remove foo5
)
function foo5()
v = Vector{Int}(undef, 2^50)
v[1] = 5
v[1]
end