Skip to content

SumOfSquares error in inference #57852

Closed
@vtjnash

Description

@vtjnash

Looking at the segfault in https://s3.amazonaws.com/julialang-reports/nanosoldier/pkgeval/by_date/2025-03/18/SumOfSquares.primary.log, inference is coming to the wrong answer on master

julia> using MathOptInterface, MutableArithmetics, MultivariateMoments

julia> code_typed(MutableArithmetics.promote_operation, Tuple{typeof(MultivariateMoments.:+), Type{MathOptInterface.VariableIndex}, Type{MathOptInterface.ScalarAffineFunction{Complex{Float64}}} where _A}, optimize=false)
[ Warning: + is defined in Base and is not public in MultivariateMoments
1-element Vector{Any}:
 CodeInfo(
    @ /home/vtjnash/.julia/packages/MathOptInterface/jGuEH/src/Utilities/mutable_arithmetics.jl:90 within `unknown scope`
1 ─ %1 = MathOptInterface.Utilities.promote_operation::Core.Const(MathOptInterface.Utilities.promote_operation)
│   %2 = $(Expr(:static_parameter, 1))::Core.Const(ComplexF64)
│   %3 =   dynamic (%1)(op, %2, F, G)::Core.Const(MathOptInterface.ScalarAffineFunction{ComplexF64})
└──      return %3
) => Type{MathOptInterface.ScalarAffineFunction{ComplexF64}}

julia> code_typed(MutableArithmetics.promote_operation, Tuple{typeof(MultivariateMoments.:+), Type{MathOptInterface.VariableIndex}, Type{MathOptInterface.ScalarAffineFunction{Complex{_A}}} where _A}, optimize=false)
1-element Vector{Any}:
 CodeInfo(
    @ /home/vtjnash/.julia/packages/MathOptInterface/jGuEH/src/Utilities/mutable_arithmetics.jl:90 within `unknown scope`
1 ─ %1 = MathOptInterface.Utilities.promote_operation::Core.Const(MathOptInterface.Utilities.promote_operation)
│   %2 = $(Expr(:static_parameter, 1))::Type{T} where T<:(Complex{_A} where _A)
│          dynamic (%1)(op, %2, F, G)::Union{}
└──      Core.Const(:(return %3))::Union{}
) => Union{}

on v1.12 this was

julia> code_typed(MutableArithmetics.promote_operation, Tuple{typeof(MultivariateMoments.:+), Type{MathOptInterface.VariableIndex}, Type{MathOptInterface.ScalarAffineFunction{Complex{_A}}} where _A}, optimize=false)
1-element Vector{Any}:
 CodeInfo(
    @ /home/vtjnash/.julia/packages/MathOptInterface/jGuEH/src/Utilities/mutable_arithmetics.jl:90 within `unknown scope`
1 ─ %1 = MathOptInterface.Utilities.promote_operation::Core.Const(MathOptInterface.Utilities.promote_operation)
│   %2 = $(Expr(:static_parameter, 1))::Type{T} where T<:(Complex{_A} where _A)
│   %3 =   dynamic (%1)(op, %2, F, G)::Type{MathOptInterface.ScalarAffineFunction{Complex{_A}}} where _A
└──      return %3
) => Type{MathOptInterface.ScalarAffineFunction{Complex{_A}}} where _A

Metadata

Metadata

Assignees

No one assigned

    Labels

    regressionRegression in behavior compared to a previous versiontypes and dispatchTypes, subtyping and method dispatch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions