Skip to content

@inbounds isn't propagated for CartesianIndices #42115

Closed
@Tokazama

Description

@Tokazama

Recent discussion in ArrayInterface.jl demonstrated that @inbounds isn't fully propagated when using CartesianIndices to convert an integer to a CartesianIndex.
Examples across multiple versions and hardware are more fully demonstrated here JuliaArrays/ArrayInterface.jl#199).

I think the offending line is the missing @propagate_inbounds here:

function _getindex(::IndexCartesian, A::AbstractArray, I::Vararg{Int,M}) where M

This could probably be fixed here also:

function _getindex(::IndexLinear, A::AbstractArray, I::Vararg{Int,M}) where M

I think @timholy and @mbauman wrote the original code here.
Can we just put @propagate_inbounds in front of these?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions