Skip to content

Julia level miscompile in 1.10 and 1.11 #57441

Closed as not planned
Closed as not planned
@oscardssmith

Description

@oscardssmith

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorcompiler:optimizerOptimization passes (mostly in base/compiler/ssair/)fixed on masterregression 1.10Regression in the 1.10 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions