JuliaSIMD / JuliaSIMD/LoopVectorization.jl

`@turbo` and destructuring assignments

Aperta
#422 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Julia
Stelle
789
Fork
73
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### Discussed in https://github.com/JuliaSIMD/LoopVectorization.jl/discussions/421

Originally posted by **matthias314** August 16, 2022
It seems that destructuring assignments inside a loop may lead to wrong results. The example
```
function swap(v, w)
@turbo for i in axes(v, 1)
v[i], w[i] = w[i], v[i]
end
end
```
gives
```
julia> v = [0, 0];
julia> w = [1, 1];
julia> swap(v, w);
julia> v[1], w[1]
(1, 1) # wrong
```
I don't know if this is a bug or part of the "don't rely on a specific execution order" rule. In the latter case, would it make sense to mention this case explicitly in the documentation? After all, it's formally a single statement.


It has been confirmed that it's a bug.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.