Skip to content

Commit 87d74c9

Browse files
authored
Add (broken) tests for allocation in 5-arg mul!()
See JuliaLang#47206 for a fix proposal.
1 parent 8b19f5f commit 87d74c9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

stdlib/LinearAlgebra/test/matmul.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -978,5 +978,18 @@ end
978978
@test *(a, b, c, 99.9) (a * b) * (c * 99.9)
979979
end
980980
end
981+
982+
@testset "Issue #46865: mul!() with non-const alpha, beta" begin
983+
f!(C,A,B,alphas,betas) = mul!(C, A, B, alphas[1], betas[1])
984+
alphas = [1.0]
985+
betas = [0.5]
986+
for d in [2,3,4] # test native small-matrix cases as well as BLAS
987+
A = rand(d,d)
988+
B = copy(A)
989+
C = copy(A)
990+
f!(C, A, B, alphas, betas)
991+
@test_broken (@allocated f!(C, A, B, alphas, betas)) == 0
992+
end
993+
end
981994

982995
end # module TestMatmul

0 commit comments

Comments
 (0)