Code working in 0.6.4 crashes in 0.7

bug

#1

Hello, thanks in advance for any guidance provided.

I was migrating some code from 0.6.4 to 0.7, as a previous step to moving to 1.0: the very same code works on 0.6.4 but crashes on 0.7. To be honest, I don’t fully understand the backtrace, which I copy here:

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x6b5cf5b7 -- jl_new_structv at /home/Administrator/buildbot/worker/package_win64/build/src\datatype.c:774
in expression starting at C:\Users\Trading\Repo\gasteiz\problem.jl:28
jl_set_nth_field at /home/Administrator/buildbot/worker/package_win64/build/src\datatype.c:889 [inlined]
jl_new_structv at /home/Administrator/buildbot/worker/package_win64/build/src\datatype.c:781
Type at C:\Users\Trading\Repo\gasteiz\problem.jl:12
bullet at C:\Users\Trading\Repo\gasteiz\problem.jl:25
unknown function (ip: 000000001DF04273)
jl_fptr_trampoline at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:1829
jl_apply_generic at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:2182
do_call at /home/Administrator/buildbot/worker/package_win64/build/src\interpreter.c:324
eval_value at /home/Administrator/buildbot/worker/package_win64/build/src\interpreter.c:428
eval_stmt_value at /home/Administrator/buildbot/worker/package_win64/build/src\interpreter.c:363 [inlined]
eval_body at /home/Administrator/buildbot/worker/package_win64/build/src\interpreter.c:682
jl_interpret_toplevel_thunk_callback at /home/Administrator/buildbot/worker/package_win64/build/src\interpreter.c:799
unknown function (ip: FFFFFFFFFFFFFFFE)
unknown function (ip: 0000000010B2339F)
unknown function (ip: 0000000000000001)
jl_toplevel_eval_flex at /home/Administrator/buildbot/worker/package_win64/build/src\toplevel.c:831
jl_parse_eval_all at /home/Administrator/buildbot/worker/package_win64/build/src\ast.c:841
jl_load at /home/Administrator/buildbot/worker/package_win64/build/src\toplevel.c:865 [inlined]
jl_load_ at /home/Administrator/buildbot/worker/package_win64/build/src\toplevel.c:872
include at .\boot.jl:317 [inlined]
include_relative at .\loading.jl:1038
include at .\sysimg.jl:29
jl_apply_generic at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:2182
exec_options at .\client.jl:239
_start at .\client.jl:432
jl_apply_generic at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:2182
jl_apply at /home/Administrator/buildbot/worker/package_win64/build/src\julia.h:1538 [inlined]
true_main at /home/Administrator/buildbot/worker/package_win64/build/ui\repl.c:112
wmain at /home/Administrator/buildbot/worker/package_win64/build/ui\repl.c:233
__tmainCRTStartup at /usr/src/debug/mingw64-x86_64-runtime-5.0.3-1/crt\crtexe.c:329
mainCRTStartup at /usr/src/debug/mingw64-x86_64-runtime-5.0.3-1/crt\crtexe.c:212
BaseThreadInitThunk at C:\WINDOWS\System32\KERNEL32.DLL (unknown line)
RtlUserThreadStart at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
Allocations: 646046 (Pool: 645910; Big: 136); GC: 0

Julia’s binary was the official 0.7 release, downloaded yesterday. I am working on Windows 10 Home (64-bit); if any further details are needed, I will gladly provide.

The problematic code is:

using Dates

const unixdate = Float64
const calendar = Array{unixdate, 1}

type capital
    deltadates::calendar
    capital::Array{Float64, 1}
end

function todayunix()
    Dates.datetime2unix(now())
end

function unixdate(year::Int64, month::Int64, day::Int64)
    Dates.datetime2unix(Dates.DateTime(year, month, day))
end

function bullet(inception::unixdate, maturity::unixdate)
    capital(calendar([inception, maturity]), [1.0, 0.0])
end

bullet(unixdate(2017,6,21), unixdate(2016,11,2)) # When I run this line, Julia crashes

Any advice on how to procede will be appreciated.
Thanks in advance.


#2

seems to be a julia 0.7 bug! I can reproduce it on 0.7, but not on 1.0.2!


#3

It is good to know; I can just jump from 0.6.4 to 1.x and avoid the problem (using 0.7.0 was intended to get deprecation warnings; I guess the transition will be a little less smoother hehe).

Thanks!