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

Calling isdefined with integer argument results in failed assertion or wrong result #22929

Closed
simonster opened this issue Jul 24, 2017 · 1 comment
Assignees
Labels
kind:bug Indicates an unexpected problem or unintended behavior kind:regression Regression in behavior compared to a previous version

Comments

@simonster
Copy link
Member

simonster commented Jul 24, 2017

On a release build (commit 7287321), isdefined with a field index returns the correct result if called from the REPL, but an incorrect result if called within a function:

julia> mutable struct MyStruct
           len::Int
           data::Array{Float64}
           MyStruct(len::Int) = new(len)
           MyStruct(len::Int, data::Array{Float64}) = new(len, data)
       end

julia> ms = MyStruct(2, [3.2, -1.7])
MyStruct(2, [3.2, -1.7])

julia> isdefined(ms, 2)
true

julia> f(x) = isdefined(x, 2)
f (generic function with 1 method)

julia> f(ms)
false

On a debug build, Julia crashes at the last line with:

Assertion failed: (jl_is_primitivetype(jl_typeof(v))), function jl_unbox_int64, file /usr/local/julia/src/datatype.c, line 541.

signal (6): Abort trap: 6
while loading no file, in expression starting on line 0
__pthread_kill at /usr/lib/system/libsystem_kernel.dylib (unknown line)
Allocations: 3096855 (Pool: 3096325; Big: 530); GC: 6
fish: '/usr/local/julia/julia' terminated by signal SIGABRT (Abort)

This is a relatively recent issue that is only present on master. #22769 seems like a possible culprit, but I haven't bisected.

@simonster simonster added kind:bug Indicates an unexpected problem or unintended behavior kind:regression Regression in behavior compared to a previous version labels Jul 24, 2017
@yuyichao yuyichao self-assigned this Jul 24, 2017
yuyichao added a commit that referenced this issue Jul 24, 2017
@yuyichao
Copy link
Contributor

No it's from #22818 ...

yuyichao added a commit that referenced this issue Jul 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Indicates an unexpected problem or unintended behavior kind:regression Regression in behavior compared to a previous version
Projects
None yet
Development

No branches or pull requests

2 participants