Closed as not planned
Description
On 1.10 and 1.11, f(x) = isnan(x) ? NaN : f(x)
returns NaN
instead of the expected StackOverflowError that it returns on 1.6-1.9 and nightly. The @code_typed
is
CodeInfo(
1 ─ %1 = Base.ne_float(x, x)::Bool
└── goto #3 if not %1
2 ─ return Main.NaN
3 ─ return NaN
) => Float64
while before optimization we get
julia> @code_typed optimize=false f(1.0)
CodeInfo(
1 ─ %1 = Main.isnan::Core.Const(isnan)
│ %2 = (%1)(x)::Bool
└── goto #3 if not %2
2 ─ %4 = Main.NaN::Core.Const(NaN)
└── return %4
3 ─ %6 = Main.f::Core.Const(f)
│ %7 = (%6)(x)::Core.Const(NaN)
└── return %7
) => Float64
so this appears to be a bug in Julia level optimization.