-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
comprehensions segfault if length and done are inconsistent #7427
Comments
Can't you segfault basically any function in There is a general danger here that arises from using |
I don't think this issue should be all that common outside of functions that use comprehensions. Most of the functions that operate on AbstractArrays using y = Array(T, length(a))
i = 1
for x in a
@inbounds y[i] = f(x)
i += 1
end This is used because indexing via |
It's pretty easy to make any
|
I think that crash is due to the aforementioned issue of |
Comprehensions can be fixed to apply |
Rather, I should say comprehensions could iterate based on the length instead of the range's done method. This might actually be faster since we can avoid calling |
Clearly this is a pathological case, but I'm not sure it's acceptable to segfault, since the
@inbounds
is implicit in the comprehension and not part of the code I wrote.I discovered this because of #7426, but it's a different code path.
The text was updated successfully, but these errors were encountered: