Skip to content

assigning a constant #38

@jaakkor2

Description

@jaakkor2
function f1a()
   A = zeros(8)
   @avx for i in 1:size(A)[1]
      A[i] = 1.0
   end
   return A
end

gives

ERROR: BoundsError: attempt to access ()
  at index [1]
Stacktrace:
 [1] getindex(::Tuple, ::Int64) at .\tuple.jl:24
 [2] sizeofeltypes(::Tuple{}, ::Int64) at C:\Users\jr\.julia\packages\LoopVectorization\9Qgzg\src\reconstruct_loopset.jl:204
 [3] avx_body(::Tuple{Int8,Int8,Int8}, ::Array{LoopVectorization.Instruction,1}, ::Array{LoopVectorization.OperationStruct,1}, ::Array{LoopVectorization.ArrayRefStruct,1}, ::Core.SimpleVector, ::Core.SimpleVector, ::Tuple{}) at C:\Users\jr\.julia\packages\LoopVectorization\9Qgzg\src\reconstruct_loopset.jl:215
 [4] #s41#61 at C:\Users\jr\.julia\packages\LoopVectorization\9Qgzg\src\reconstruct_loopset.jl:236 [inlined]
 [5] #s41#61(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Type, ::Type, ::Type, ::Any, ::Any, ::Any) at .\none:0
 [6] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any,N} where N) at .\boot.jl:524
 [7] f1a() at .\REPL[10]:3
 [8] top-level scope at REPL[11]:1

I do not know why I would write code like this, but the problem is mainly that the error message was difficult to understand that assigning a constant is not supported.

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