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

Segfault when mapping over function returned by function #15180

Closed
andreasnoack opened this issue Feb 21, 2016 · 0 comments
Closed

Segfault when mapping over function returned by function #15180

andreasnoack opened this issue Feb 21, 2016 · 0 comments

Comments

@andreasnoack
Copy link
Member

This only happens without inlining, i.e. julia --inline=no and only after #13412 was merged. The error came up in StatsBase.jl, but it is reproducible by the code below

function ecdf{T<:Real}(X::Vector{T})
    Xs = sort(X)
    n = length(X)

    ef{T<:Real}(x::T) = searchsortedlast(Xs, x) / n

    function ef{T<:Real}(v::Vector{T})
        ord = sortperm(v)
        m = length(v)
        r = Array(T, m)
        r0 = 0

        i = 1
        for x in Xs
            while i <= m && x > v[ord[i]]
                r[ord[i]] = r0
                i += 1
            end
            r0 += 1
            if i > m 
                break 
            end
        end
        while i <= m
            r[ord[i]] = n
            i += 1
        end
        return r / n
    end

    return ef
end

map(ecdf([-1.0,1.0]), [1.0])

cc: @JeffBezanson

carnaval added a commit that referenced this issue Feb 23, 2016
Captured static parameters by other methods of the same generic
closure were only added to the '(method ...) expr but not in the vinfo
of the '(lambda ...) if said parameter was not used in the definition.
Fixes #15180.
carnaval added a commit that referenced this issue Feb 24, 2016
Captured static parameters by other methods of the same generic
closure were only added to the '(method ...) expr but not in the vinfo
of the '(lambda ...) if said parameter was not used in the definition.
Fixes #15180
carnaval added a commit that referenced this issue Feb 24, 2016
Captured static parameters by other methods of the same generic
closure were only added to the '(method ...) expr but not in the vinfo
of the '(lambda ...) if said parameter was not used in the definition.
Fixes #15180
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant