Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/subtype.c:1650: local_forall_exists_subtype: Assertion e->Runions.more > oldRmore failed. #56350

Open
nsajko opened this issue Oct 26, 2024 · 2 comments
Labels
types and dispatch Types, subtyping and method dispatch

Comments

@nsajko
Copy link
Contributor

nsajko commented Oct 26, 2024

Reproducer:

# Adapted from the TypeDomainNaturalNumbers.jl package
module TypeDomainNumbers
    module Zeros
        export Zero
        struct Zero end
    end

    module PositiveIntegers
        module RecursiveStep
            using ...Zeros
            export recursive_step
            function recursive_step(@nospecialize t::Type)
                Union{Zero, t}
            end
        end
        module UpperBounds
            using ..RecursiveStep
            abstract type A end
            abstract type B{P <: recursive_step(A)} <: A    end
            abstract type C{P <: recursive_step(B)} <: B{P} end
            abstract type D{P <: recursive_step(C)} <: C{P} end
            abstract type E{P <: recursive_step(D)} <: D{P} end
        end
        using .RecursiveStep
        const PositiveIntegerUpperBound = UpperBounds.A
        const PositiveIntegerUpperBoundTighter = UpperBounds.E
        export
            natural_successor, natural_predecessor,
            NonnegativeInteger, NonnegativeIntegerUpperBound,
            PositiveInteger, PositiveIntegerUpperBound,
            type_assert_nonnegative_integer, type_assert_positive_integer
        struct PositiveInteger{
            Predecessor <: recursive_step(PositiveIntegerUpperBoundTighter),
        } <: PositiveIntegerUpperBoundTighter{Predecessor}
            predecessor::Predecessor
            global const NonnegativeInteger = recursive_step(PositiveInteger)
            global const NonnegativeIntegerUpperBound = recursive_step(PositiveIntegerUpperBound)
            global function natural_successor(p::P) where {P <: NonnegativeInteger}
                r = new{P}(p)
                type_assert_positive_integer(r)
            end
        end
        function type_assert_nonnegative_integer(@nospecialize x::NonnegativeInteger)
            x
        end
        function type_assert_positive_integer(@nospecialize x::PositiveInteger)
            x
        end
        function natural_predecessor(@nospecialize o::PositiveInteger)
            r = getfield(o, :predecessor)  # avoid specializing `getproperty` for each number
            type_assert_nonnegative_integer(r)
        end
    end

    module IntegersGreaterThanOne
        using ..PositiveIntegers
        export
            IntegerGreaterThanOne, IntegerGreaterThanOneUpperBound,
            type_assert_integer_greater_than_one
        const IntegerGreaterThanOne = let t = PositiveInteger
            t{P} where {P <: t}
        end
        const IntegerGreaterThanOneUpperBound = let t = PositiveIntegerUpperBound
            PositiveIntegers.UpperBounds.B{P} where {P <: t}
        end
        function type_assert_integer_greater_than_one(@nospecialize x::IntegerGreaterThanOne)
            x
        end
    end

    module Constants
        using ..Zeros, ..PositiveIntegers
        export n0, n1
        const n0 = Zero()
        const n1 = natural_successor(n0)
    end

    module Utils
        using ..PositiveIntegers, ..IntegersGreaterThanOne, ..Constants
        export minus_two, half_floor, half_ceiling
        function minus_two(@nospecialize m::IntegerGreaterThanOne)
            natural_predecessor(natural_predecessor(m))
        end
        function half_floor(@nospecialize m::NonnegativeInteger)
            ret = if m isa IntegerGreaterThanOneUpperBound
                let n = minus_two(m), rec = @inline half_floor(n)
                    type_assert_positive_integer(natural_successor(rec))
                end
            else
                n0
            end
            type_assert_nonnegative_integer(ret)
        end
        function half_ceiling(@nospecialize m::NonnegativeInteger)
            ret = if m isa IntegerGreaterThanOneUpperBound
                let n = minus_two(m), rec = @inline half_ceiling(n)
                    type_assert_positive_integer(natural_successor(rec))
                end
            else
                if m isa PositiveIntegerUpperBound
                    n1
                else
                    n0
                end
            end
            type_assert_nonnegative_integer(ret)
        end
    end
end

module NonnegativeIntegerStrictlyBinaryTrees
    module RecursiveStep
        using ...TypeDomainNumbers.PositiveIntegers
        export recursive_step
        function recursive_step(@nospecialize t::Type)
            Union{
                NonnegativeInteger,
                Tuple{NonnegativeInteger, NonnegativeInteger},
                Tuple{NonnegativeInteger, t},
                Tuple{t, NonnegativeInteger},
                Tuple{Vararg{t, 2}},
            }
        end
    end
    module UpperBounds
        using ..RecursiveStep
        abstract type A end
        abstract type B{P <: recursive_step(A)} <: A end
        abstract type C{P <: recursive_step(B)} <: B{P} end
        abstract type D{P <: recursive_step(C)} <: C{P} end
        abstract type E{P <: recursive_step(D)} <: D{P} end
    end
    using .RecursiveStep
    const NonnegativeIntegerStrictlyBinaryTreeNonleafUpperBound = UpperBounds.A
    const NonnegativeIntegerStrictlyBinaryTreeNonleafUpperBoundTighter = UpperBounds.E
    using ..TypeDomainNumbers.PositiveIntegers
    export
        NonnegativeIntegerStrictlyBinaryTree, NonnegativeIntegerStrictlyBinaryTreeNonleaf, tree_value, tree_children,
        NonnegativeIntegerStrictlyBinaryTreeNonleafUpperBound, type_assert_nonnegative_integer_strictly_binary_tree,
        type_assert_nonnegative_integer_strictly_binary_tree_nonleaf
    struct NonnegativeIntegerStrictlyBinaryTreeNonleaf{
        Value <: NonnegativeInteger,
        Children <: recursive_step(NonnegativeIntegerStrictlyBinaryTreeNonleafUpperBoundTighter),
    } <: NonnegativeIntegerStrictlyBinaryTreeNonleafUpperBoundTighter{Children}
        value::Value
        children::Children
        global const NonnegativeIntegerStrictlyBinaryTree = Union{NonnegativeInteger, NonnegativeIntegerStrictlyBinaryTreeNonleaf}
        function NonnegativeIntegerStrictlyBinaryTreeNonleaf(v::Value, c::Children) where {
            Value <: NonnegativeInteger,
            Children <: recursive_step(NonnegativeIntegerStrictlyBinaryTreeNonleaf),
        }
            new{Value, Children}(v, c)
        end
    end
    function type_assert_nonnegative_integer_strictly_binary_tree_nonleaf(@nospecialize x::NonnegativeIntegerStrictlyBinaryTreeNonleaf)
        x
    end
    function type_assert_nonnegative_integer_strictly_binary_tree(@nospecialize x::NonnegativeIntegerStrictlyBinaryTree)
        x
    end
    function tree_value(@nospecialize tree::NonnegativeIntegerStrictlyBinaryTree)
        if tree isa NonnegativeIntegerStrictlyBinaryTreeNonleafUpperBound
            tree.value
        else
            tree
        end
    end
    function tree_children(@nospecialize tree::NonnegativeIntegerStrictlyBinaryTreeNonleaf)
        tree.children
    end
end

module TupleTypeAliases
    export
        Tuple1OrMore, Tuple2OrMore,
        type_assert_tuple, type_assert_tuple_1_or_more, type_assert_tuple_2_or_more,
        type_assert_tuple_0_or_1
    const Tuple1OrMore = Tuple{Any, Vararg}
    const Tuple2OrMore = Tuple{Any, Any, Vararg}
    function type_assert_tuple(@nospecialize x::Tuple)
        x
    end
    function type_assert_tuple_1_or_more(@nospecialize x::Tuple1OrMore)
        x
    end
    function type_assert_tuple_2_or_more(@nospecialize x::Tuple2OrMore)
        x
    end
    function type_assert_tuple_0_or_1(@nospecialize x::Union{Tuple{}, Tuple{Any}})
        x
    end
end

module TypeDomainNumberTupleUtils
    using
        ..TypeDomainNumbers.PositiveIntegers, ..TypeDomainNumbers.IntegersGreaterThanOne,
        ..TypeDomainNumbers.Constants, ..TupleTypeAliases
    using Base: tail, front
    export tuple_type_domain_length, skip_from_front, skip_from_tail
    function tuple_type_domain_length(@nospecialize tup::Tuple)
        ret = if tup isa Tuple1OrMore
            let t = tail(tup), rec = @inline tuple_type_domain_length(t)
                type_assert_positive_integer(natural_successor(rec))
            end
        else
            n0
        end
        type_assert_nonnegative_integer(ret)
    end
    function skip_from_front((@nospecialize tup::Tuple), @nospecialize skip_count::NonnegativeInteger)
        if skip_count isa PositiveIntegerUpperBound
            let cm1 = natural_predecessor(skip_count), t = tail(tup)
                @inline skip_from_front(t, cm1)
            end
        else
            tup
        end
    end
    function skip_from_tail((@nospecialize tup::Tuple), @nospecialize skip_count::NonnegativeInteger)
        if skip_count isa PositiveIntegerUpperBound
            let cm1 = natural_predecessor(skip_count), t = front(tup)
                @inline skip_from_tail(t, cm1)
            end
        else
            tup
        end
    end
end

module SortTupleStable
    using
        ..TypeDomainNumbers.PositiveIntegers, ..TypeDomainNumbers.IntegersGreaterThanOne, ..TypeDomainNumbers.Utils,
        ..NonnegativeIntegerStrictlyBinaryTrees, ..TupleTypeAliases, ..TypeDomainNumberTupleUtils
    using Base: tail
    using Base.Order: Ordering, lt
    export sort_tuple_stable
    function merge((@nospecialize a::Tuple), (@nospecialize b::Tuple), ord::Ordering)
        ret = if a isa Tuple1OrMore
            if b isa Tuple1OrMore
                let l = first(a), r = first(b),
                    x = tail(a), y = tail(b),
                    rx = type_assert_tuple_1_or_more(@inline merge(x, b, ord)),
                    ry = type_assert_tuple_1_or_more(@inline merge(a, y, ord)),
                    merged = if lt(ord, r, l)
                        (r, ry...)
                    else
                        (l, rx...)
                    end
                    type_assert_tuple_2_or_more(merged)
                end
            else
                a
            end
        else
            b
        end
        type_assert_tuple(ret)
    end
    function binary_tree_from_nonnegative_integer(@nospecialize len::NonnegativeInteger)
        ret = if len isa IntegerGreaterThanOneUpperBound
            let vl = type_assert_positive_integer(half_floor(len)),
                vr = type_assert_positive_integer(half_ceiling(len)),
                tl = type_assert_nonnegative_integer_strictly_binary_tree(@inline binary_tree_from_nonnegative_integer(vl)),
                tr = type_assert_nonnegative_integer_strictly_binary_tree(@inline binary_tree_from_nonnegative_integer(vr))
                type_assert_nonnegative_integer_strictly_binary_tree_nonleaf(NonnegativeIntegerStrictlyBinaryTreeNonleaf(len, (tl, tr)))
            end
        else
            len
        end
        type_assert_nonnegative_integer_strictly_binary_tree(ret)
    end
    function binary_tree_from_tuple(@nospecialize tup::Tuple)
        binary_tree_from_nonnegative_integer(tuple_type_domain_length(tup))
    end
    function sort_tuple_stable_with_tree(ord::Ordering, (@nospecialize tree::NonnegativeIntegerStrictlyBinaryTree), @nospecialize tup::Tuple)
        ret = if tree isa NonnegativeIntegerStrictlyBinaryTreeNonleafUpperBound
            let (tree_l, tree_r) = tree_children(tree),
                len_l = tree_value(tree_l),
                len_r = tree_value(tree_r),
                tup = type_assert_tuple_2_or_more(tup),
                tup_l = type_assert_tuple_1_or_more(skip_from_tail(tup, len_r)),
                tup_r = type_assert_tuple_1_or_more(skip_from_front(tup, len_l)),
                sorted_l = type_assert_tuple_1_or_more(@inline sort_tuple_stable_with_tree(ord, tree_l, tup_l)),
                sorted_r = type_assert_tuple_1_or_more(@inline sort_tuple_stable_with_tree(ord, tree_r, tup_r))
                type_assert_tuple_2_or_more(merge(sorted_l, sorted_r, ord))
            end
        else
            type_assert_tuple_0_or_1(tup)
        end
        type_assert_tuple(ret)
    end
    function sort_tuple_stable_2_or_more(ord::Ordering, @nospecialize tup::Tuple2OrMore)
        tree = binary_tree_from_tuple(tup)
        sort_tuple_stable_with_tree(ord, tree, tup)
    end
    function sort_tuple_stable(ord::Ordering, @nospecialize tup::Tuple)
        if tup isa Tuple2OrMore
            sort_tuple_stable_2_or_more(ord, tup)
        else
            tup
        end
    end
end

T = Tuple{Int, Int, Int, Vararg{Int}}
Base.infer_return_type(SortTupleStable.sort_tuple_stable, Tuple{Base.Order.ForwardOrdering, T})

Versioninfo:

Julia Version 1.12.0-DEV.1499
Commit 2b3a0f0ab41 (2024-10-25 15:49 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × AMD Ryzen 3 5300U with Radeon Graphics
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, znver2)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)
Environment:
  JULIA_NUM_PRECOMPILE_TASKS = 4
  JULIA_PKG_PRECOMPILE_AUTO = 0

Output with assertion and stack trace:

julia: /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1650: local_forall_exists_subtype: Assertion `e->Runions.more > oldRmore' failed.

[143612] signal 6 (-6): Aborted
in expression starting at /home/nsajko/tuple_sorting/reproducer.jl:306
unknown function (ip: 0x7028e22073f4) at /usr/lib/libc.so.6
gsignal at /usr/lib/libc.so.6 (unknown line)
abort at /usr/lib/libc.so.6 (unknown line)
unknown function (ip: 0x7028e21953de) at /usr/lib/libc.so.6
__assert_fail at /usr/lib/libc.so.6 (unknown line)
local_forall_exists_subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1650
subtype_ccheck at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:698
var_gt at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:812
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1442
local_forall_exists_subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1611
forall_exists_equal at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1695
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1531
subtype_unionall at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:965
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1488
subtype_unionall at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:972
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1485
subtype_tuple_tail at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1275 [inlined]
subtype_tuple at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1354 [inlined]
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1525
var_lt at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:768
subtype_var at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:850
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1459
local_forall_exists_subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1633
subtype_ccheck at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:698
var_gt at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:812
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1442
local_forall_exists_subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1611
forall_exists_equal at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1695
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1531
subtype_unionall at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:965
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1488
subtype_unionall at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:972
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1485
subtype_tuple_tail at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1275 [inlined]
subtype_tuple at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1354 [inlined]
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1525
var_lt at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:768
subtype_var at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:850
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1459
local_forall_exists_subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1633
subtype_ccheck at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:698
var_gt at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:812
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1442
local_forall_exists_subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1611
forall_exists_equal at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1695
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1531
subtype_unionall at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:965
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1488
subtype_unionall at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:972
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1485
subtype_tuple_tail at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1275 [inlined]
subtype_tuple at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1354 [inlined]
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1525
var_lt at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:768
subtype_var at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:850
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1459
local_forall_exists_subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1633
subtype_ccheck at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:698
var_gt at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:812
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1442
local_forall_exists_subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1611
forall_exists_equal at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1695
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1531
subtype_unionall at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:965
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1488
subtype_unionall at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:972
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1485
subtype_unionall at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:972
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1485
subtype_tuple_tail at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1275 [inlined]
subtype_tuple at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1354 [inlined]
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1525
var_lt at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:768
subtype_var at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:850
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1459
local_forall_exists_subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1633
subtype_ccheck at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:698
var_gt at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:812
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1442
local_forall_exists_subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1611
forall_exists_equal at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1695
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1531
subtype_unionall at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:965
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1488
subtype_unionall at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:965
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1488
subtype_unionall at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:972
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1485
subtype_unionall at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:972
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1485
subtype_tuple_tail at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1275 [inlined]
subtype_tuple at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1354 [inlined]
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1525
var_lt at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:768
subtype_var at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:850
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1459
local_forall_exists_subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1633
subtype_ccheck at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:698
var_gt at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:812
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1442
local_forall_exists_subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1611
forall_exists_equal at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1695
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1531
subtype_unionall at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:965
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1488
subtype_unionall at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:965
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1488
subtype_unionall at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:972
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1485
subtype_unionall at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:972
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1485
var_lt at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:768
subtype_var at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:850
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1459
local_forall_exists_subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1633
subtype_ccheck at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:698
var_gt at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:812
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1442
local_forall_exists_subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1611
forall_exists_equal at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1695
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1531
subtype_unionall at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:965
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1488
subtype_unionall at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:972
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1485
exists_subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1713 [inlined]
forall_exists_subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1742
ijl_subtype_env at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:2201
subtype_tuple_tail at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1272 [inlined]
subtype_tuple at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1354 [inlined]
subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1525
exists_subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1713 [inlined]
forall_exists_subtype at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:1742
ijl_types_equal at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:2294 [inlined]
ijl_types_equal at /cache/build/builder-amdci5-6/julialang/julia-master/src/subtype.c:2241
ijl_method_table_add_backedge at /cache/build/builder-amdci5-6/julialang/julia-master/src/gf.c:1871
store_backedges at ./compiler/typeinfer.jl:512
store_backedges at ./compiler/typeinfer.jl:503 [inlined]
#finish!#323 at ./compiler/typeinfer.jl:102
finish! at ./compiler/typeinfer.jl:95
jfptr_finishNOT._47421.1 at /home/nsajko/tmp/jl/jl/nightly_assert/julia-2b3a0f0ab4/lib/julia/sys.so (unknown line)
_jl_invoke at /cache/build/builder-amdci5-6/julialang/julia-master/src/gf.c:3289 [inlined]
ijl_apply_generic at /cache/build/builder-amdci5-6/julialang/julia-master/src/gf.c:3477
finish_nocycle at ./compiler/typeinfer.jl:151
jfptr_finish_nocycle_47440.1 at /home/nsajko/tmp/jl/jl/nightly_assert/julia-2b3a0f0ab4/lib/julia/sys.so (unknown line)
_jl_invoke at /cache/build/builder-amdci5-6/julialang/julia-master/src/gf.c:3289 [inlined]
ijl_apply_generic at /cache/build/builder-amdci5-6/julialang/julia-master/src/gf.c:3477
typeinf at ./compiler/abstractinterpretation.jl:3810
const_prop_call at ./compiler/abstractinterpretation.jl:1348
abstract_call_method_with_const_args at ./compiler/abstractinterpretation.jl:904
abstract_call_method_with_const_args at ./compiler/abstractinterpretation.jl:874 [inlined]
handle1 at ./compiler/abstractinterpretation.jl:106
infercalls at ./compiler/abstractinterpretation.jl:176
jfptr_infercalls_52715.1 at /home/nsajko/tmp/jl/jl/nightly_assert/julia-2b3a0f0ab4/lib/julia/sys.so (unknown line)
_jl_invoke at /cache/build/builder-amdci5-6/julialang/julia-master/src/gf.c:3289 [inlined]
ijl_apply_generic at /cache/build/builder-amdci5-6/julialang/julia-master/src/gf.c:3477
abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:252
abstract_call_unknown at ./compiler/abstractinterpretation.jl:2522
abstract_call at ./compiler/abstractinterpretation.jl:2532
abstract_call at ./compiler/abstractinterpretation.jl:2528 [inlined]
abstract_call at ./compiler/abstractinterpretation.jl:2683
abstract_eval_call at ./compiler/abstractinterpretation.jl:2701
abstract_eval_statement_expr at ./compiler/abstractinterpretation.jl:2942
typeinf_local at ./compiler/abstractinterpretation.jl:3608
jfptr_typeinf_local_53566.1 at /home/nsajko/tmp/jl/jl/nightly_assert/julia-2b3a0f0ab4/lib/julia/sys.so (unknown line)
_jl_invoke at /cache/build/builder-amdci5-6/julialang/julia-master/src/gf.c:3289 [inlined]
ijl_apply_generic at /cache/build/builder-amdci5-6/julialang/julia-master/src/gf.c:3477
typeinf at ./compiler/abstractinterpretation.jl:3806
typeinf_type at ./compiler/typeinfer.jl:1143
typeinf_type at ./compiler/typeinfer.jl:1115 [inlined]
#infer_return_type#24 at ./reflection.jl:664
infer_return_type at ./reflection.jl:650
unknown function (ip: 0x7028e0f015a6) at (unknown file)
_jl_invoke at /cache/build/builder-amdci5-6/julialang/julia-master/src/gf.c:3289 [inlined]
ijl_apply_generic at /cache/build/builder-amdci5-6/julialang/julia-master/src/gf.c:3477
jl_apply at /cache/build/builder-amdci5-6/julialang/julia-master/src/julia.h:2237 [inlined]
do_call at /cache/build/builder-amdci5-6/julialang/julia-master/src/interpreter.c:125
eval_value at /cache/build/builder-amdci5-6/julialang/julia-master/src/interpreter.c:222
eval_stmt_value at /cache/build/builder-amdci5-6/julialang/julia-master/src/interpreter.c:173 [inlined]
eval_body at /cache/build/builder-amdci5-6/julialang/julia-master/src/interpreter.c:685
jl_interpret_toplevel_thunk at /cache/build/builder-amdci5-6/julialang/julia-master/src/interpreter.c:892
jl_toplevel_eval_flex at /cache/build/builder-amdci5-6/julialang/julia-master/src/toplevel.c:1055
jl_toplevel_eval_flex at /cache/build/builder-amdci5-6/julialang/julia-master/src/toplevel.c:995
ijl_toplevel_eval at /cache/build/builder-amdci5-6/julialang/julia-master/src/toplevel.c:1066
ijl_toplevel_eval_in at /cache/build/builder-amdci5-6/julialang/julia-master/src/toplevel.c:1108
eval at ./boot.jl:458
include_string at ./loading.jl:2841
_jl_invoke at /cache/build/builder-amdci5-6/julialang/julia-master/src/gf.c:3289 [inlined]
ijl_apply_generic at /cache/build/builder-amdci5-6/julialang/julia-master/src/gf.c:3477
_include at ./loading.jl:2901
include at ./Base.jl:590
exec_options at ./client.jl:329
_start at ./client.jl:558
jfptr__start_80582.1 at /home/nsajko/tmp/jl/jl/nightly_assert/julia-2b3a0f0ab4/lib/julia/sys.so (unknown line)
_jl_invoke at /cache/build/builder-amdci5-6/julialang/julia-master/src/gf.c:3289 [inlined]
ijl_apply_generic at /cache/build/builder-amdci5-6/julialang/julia-master/src/gf.c:3477
jl_apply at /cache/build/builder-amdci5-6/julialang/julia-master/src/julia.h:2237 [inlined]
true_main at /cache/build/builder-amdci5-6/julialang/julia-master/src/jlapi.c:900
jl_repl_entrypoint at /cache/build/builder-amdci5-6/julialang/julia-master/src/jlapi.c:1059
main at /cache/build/builder-amdci5-6/julialang/julia-master/cli/loader_exe.c:58
unknown function (ip: 0x7028e2196e07) at /usr/lib/libc.so.6
__libc_start_main at /usr/lib/libc.so.6 (unknown line)
unknown function (ip: 0x4010b8) at /workspace/srcdir/glibc-2.17/csu/../sysdeps/x86_64/start.S
Allocations: 114294314 (Pool: 114294304; Big: 10); GC: 118
Aborted (core dumped)
@nsajko nsajko added bug Indicates an unexpected problem or unintended behavior regression 1.12 Regression in the 1.12 release types and dispatch Types, subtyping and method dispatch labels Oct 26, 2024
@nsajko nsajko changed the title src/subtype.c:1650: local_forall_exists_subtype: Assertion `e->Runions.more > oldRmore' failed. src/subtype.c:1650: local_forall_exists_subtype: Assertion e->Runions.more > oldRmore failed. Oct 26, 2024
@nsajko
Copy link
Contributor Author

nsajko commented Oct 27, 2024

Bisected to f3a36d7 (#56007), cc @N5N3.

@N5N3
Copy link
Member

N5N3 commented Oct 27, 2024

Looks like we get a union bit stack overflow here.
I failed to get a subtype MWE as local logging shows that it's super complex.

@vtjnash vtjnash removed bug Indicates an unexpected problem or unintended behavior regression 1.12 Regression in the 1.12 release labels Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

No branches or pull requests

3 participants