JuliaArrays / JuliaArrays/StaticArrays.jl

StackOverflowError with setindex and multiple indices

Open
#1,052 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
844
Forks
159
Avg merge
3d 21h
Merged PRs (30d)
3

Description

This code (run with StaticArrays 1.5.0 and Julia 1.7.0) produces a StackOverflowError:
setindex(SVector(1:3...), SVector(4:5...), 2:3)
The above line used to work with StaticArrays v1.4.5 and earlier. I believe by dropping the "::Int" type specifier on the setindex function parameter a month ago (src/deque.jl), that causes the above line to use that function instead of another one in another package (ArrayInterfaceCore.jl - But apparently it returned an MVector...).

Note that this still works (just want to do the same with SVector):
setindex!([1, 2, 3], SVector(4:5...), 2:3)

Regardless whether this was an intended feature or not, it shouldn't throw a StackOverflowError.
This should also be a feature and it return the appropriate static array type.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the StackOverflowError with the SVector setindex expression under StaticArrays 1.5.0 and Julia 1.7.0. Inspect the setindex definition in src/deque.jl, compare the removed ::Int parameter with StaticArrays v1.4.5, and check the interaction with ArrayInterfaceCore.jl. Done means the expression no longer recurses and returns the appropriate static array type.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.