-
-
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
Segfault due to at-inbounds in _mapreducedim! #17328
Comments
|
Version 0.4.5 |
Possibly related to #13510. |
Please quote the backtrace and it's impossible to tell what's happening without the code to reproduce it. |
@chipkent, thanks for the report, although it isn't really actionable yet. See https://github.com/JuliaLang/julia/blob/master/CONTRIBUTING.md#how-to-file-a-bug-report for what you need to provide. Cheers! |
After a bit of hacking, I was able to reproduce the problem with: using NamedArrays |
bisected to b77b026, so the issue is apparently not new? Unless the package is doing something fishy, it should probably be giving an error rather than a segfault though. |
Ah, it's a bad |
@timholy what length should |
Just like julia> a = reshape([3])
0-dimensional Array{Int64,0}:
3
julia> length(a)
1 it should be julia> length(CartesianRange(()))
1
julia> for i in CartesianRange(())
@show i
end
i = CartesianIndex{0}(()) |
Looks like the issue is the Line 208 in 38c803d
CartesianIndex{0}(()) index into the reduction result accumulator, which here is a size (1,) NamedArray that does not support being indexed by dimensions it does not have.
|
If @inline getindex{T,N}(A::NamedArray{T,N}, I::Vararg{Int,N}) = ... then the generic fallbacks in base will handle this automatically. EDIT: the |
(This was basically the whole point behind #11242.) |
CC @davidavdav |
It does seem like some of the |
As long as we don't mind the performance hit, I'd be happy to get rid of However, because of the advantage of |
We've been pretending that generality comes at less of a complexity/code duplication cost than it really does, sacrificing safety on user defined array types for performance on built-in types. When we have control over the implementation and know checks are accurate we can add unsafe performance annotations. It's not safe to do so otherwise, I think. |
It would be interesting to delete all |
I am sorry |
I don't think NamedArray is entirely at fault here, it's the inbounds that is responsible for the segfault. |
No apologies necessary; I'll check out NamedArray.jl and see whether I can figure out a good solution. |
This appears to have been resolved through PRs to packages. |
Hit this segfault. Figured you would want it. Need anything else to debug it?
The text was updated successfully, but these errors were encountered: