diff --git a/src/transform/bound_array_accessors.cc b/src/transform/bound_array_accessors.cc index 19a9643a37..8d7b68e21a 100644 --- a/src/transform/bound_array_accessors.cc +++ b/src/transform/bound_array_accessors.cc @@ -70,7 +70,7 @@ ast::ArrayAccessorExpression* BoundArrayAccessors::Transform( if (size == 0) { if (is_arr) { auto* arr = ctx->Clone(expr->array()); - auto* arr_len = b.Call("arrayLength", arr); + auto* arr_len = b.Call("arrayLength", ctx->dst->AddressOf(arr)); auto* limit = b.Sub(arr_len, b.Expr(1u)); new_idx = b.Call("min", b.Construct(ctx->Clone(old_idx)), limit); } else { diff --git a/src/transform/bound_array_accessors_test.cc b/src/transform/bound_array_accessors_test.cc index 53e15d3458..e2e837e310 100644 --- a/src/transform/bound_array_accessors_test.cc +++ b/src/transform/bound_array_accessors_test.cc @@ -557,7 +557,7 @@ struct S { [[group(0), binding(0)]] var s : S; fn f() { - var d : f32 = s.b[min(u32(25), (arrayLength(s.b) - 1u))]; + var d : f32 = s.b[min(u32(25), (arrayLength(&(s.b)) - 1u))]; } )"; @@ -624,7 +624,7 @@ struct S { let c : u32 = 1u; fn f() { - let b : f32 = s.b[min(u32(c), (arrayLength(s.b) - 1u))]; + let b : f32 = s.b[min(u32(c), (arrayLength(&(s.b)) - 1u))]; let x : i32 = min(1, 2); let y : u32 = arrayLength(s.b); }