We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
reshape
DivideError
julia> reshape([], (1, :)) == reshape([], (1, 0)) true julia> reshape([], (1, :)) == reshape([], (1, 0)) == reshape([], (0, :)) # shouldn't throw ERROR: DivideError: integer division error Stacktrace: [1] div @ ./int.jl:295 [inlined] [2] divrem @ ./div.jl:203 [inlined] [3] divrem @ ./div.jl:181 [inlined] [4] _reshape_uncolon @ ./reshapedarray.jl:138 [inlined] [5] reshape(parent::Vector{Any}, dims::Tuple{Int64, Colon}) @ Base ./reshapedarray.jl:129 [6] top-level scope @ REPL[2]:1 julia> reshape([1], (0, :)) # should throw, but not `DivideError` ERROR: DivideError: integer division error Stacktrace: [1] div @ ./int.jl:295 [inlined] [2] divrem @ ./div.jl:203 [inlined] [3] divrem @ ./div.jl:181 [inlined] [4] _reshape_uncolon @ ./reshapedarray.jl:138 [inlined] [5] reshape(parent::Vector{Int64}, dims::Tuple{Int64, Colon}) @ Base ./reshapedarray.jl:129 [6] top-level scope @ REPL[2]:1 julia> b = prevpow(2, typemax(Int)) 4611686018427387904 julia> iszero(b*b) # `b` is a square root of zero, thus a zero divisor true julia> reshape([1], (b, :, b)) # should throw, but not `DivideError` ERROR: DivideError: integer division error Stacktrace: [1] div @ ./int.jl:295 [inlined] [2] divrem @ ./div.jl:203 [inlined] [3] divrem @ ./div.jl:181 [inlined] [4] _reshape_uncolon @ ./reshapedarray.jl:138 [inlined] [5] reshape(parent::Vector{Int64}, dims::Tuple{Int64, Colon, Int64}) @ Base ./reshapedarray.jl:129 [6] top-level scope @ REPL[6]:1 julia> reshape([], (b, :, b)) ERROR: DivideError: integer division error Stacktrace: [1] div @ ./int.jl:295 [inlined] [2] divrem @ ./div.jl:203 [inlined] [3] divrem @ ./div.jl:181 [inlined] [4] _reshape_uncolon @ ./reshapedarray.jl:138 [inlined] [5] reshape(parent::Vector{Any}, dims::Tuple{Int64, Colon, Int64}) @ Base ./reshapedarray.jl:129 [6] top-level scope @ REPL[4]:1
For the last example, the expected result depends on the resolution of #54244, but in any case it shouldn't throw DivideError.
I've got a fix, but waiting for a decision on #54244.
julia> versioninfo() Julia Version 1.12.0-DEV.387 Commit b5bfd83a3d0 (2024-04-22 13:12 UTC) Build Info: Official https://julialang.org/ release Platform Info: OS: Linux (x86_64-linux-gnu) CPU: 8 × AMD Ryzen 3 5300U with Radeon Graphics WORD_SIZE: 64 LLVM: libLLVM-16.0.6 (ORCJIT, znver2) Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores) Environment: JULIA_NUM_PRECOMPILE_TASKS = 3 JULIA_PKG_PRECOMPILE_AUTO = 0
This is the affected code:
julia/base/reshapedarray.jl
Lines 130 to 141 in 8f6418e
The text was updated successfully, but these errors were encountered:
fixes to colonful reshape
d56320b
In several different situations `reshape` had thrown `DivideError` instead of returning a correct result or throwing. Fixes JuliaLang#54245
77a2463
fixes to colonful reshape (#54261)
b9f68ac
Fixes #54245
fixes to colonful reshape (JuliaLang#54261)
3c5eb86
Fixes JuliaLang#54245
Successfully merging a pull request may close this issue.
For the last example, the expected result depends on the resolution of #54244, but in any case it shouldn't throw
DivideError
.I've got a fix, but waiting for a decision on #54244.
julia> versioninfo() Julia Version 1.12.0-DEV.387 Commit b5bfd83a3d0 (2024-04-22 13:12 UTC) Build Info: Official https://julialang.org/ release Platform Info: OS: Linux (x86_64-linux-gnu) CPU: 8 × AMD Ryzen 3 5300U with Radeon Graphics WORD_SIZE: 64 LLVM: libLLVM-16.0.6 (ORCJIT, znver2) Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores) Environment: JULIA_NUM_PRECOMPILE_TASKS = 3 JULIA_PKG_PRECOMPILE_AUTO = 0
This is the affected code:
julia/base/reshapedarray.jl
Lines 130 to 141 in 8f6418e
The text was updated successfully, but these errors were encountered: