diff --git a/src/compiler.jl b/src/compiler.jl index b3a01cd9c0..2554dbbab6 100644 --- a/src/compiler.jl +++ b/src/compiler.jl @@ -7160,6 +7160,9 @@ function ptr_rule(direction::Cint, ret::API.CTypeTreeRef, args::Ptr{API.CTypeTre end function inout_rule(direction::Cint, ret::API.CTypeTreeRef, args::Ptr{API.CTypeTreeRef}, known_values::Ptr{API.IntList}, numArgs::Csize_t, val::LLVM.API.LLVMValueRef)::UInt8 + if numArgs != 1 + return UInt8(false) + end inst = LLVM.Instruction(val) ce = operands(inst)[1] while isa(ce, ConstantExpr) diff --git a/test/runtests.jl b/test/runtests.jl index 702240454d..beed52c511 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -297,6 +297,9 @@ end end @test autodiff(Reverse, f9, Active, Active(2.0))[1][1] == 8 @test autodiff(Forward, f9, Duplicated(2.0, 1.0))[1] == 8 + + f10(x) = hypot(x, 2x) + @test autodiff(Reverse, f10, Active, Active(2.0))[1][1] == sqrt(5) end @testset "Taylor series tests" begin