{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/15809","repository_url":"https://api.github.com/repos/JuliaLang/julia","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/15809/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/15809/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/15809/events","html_url":"https://github.com/JuliaLang/julia/issues/15809","id":146966041,"number":15809,"title":"global inside do loop causes segfault","user":{"login":"timholy","id":1525481,"avatar_url":"https://avatars.githubusercontent.com/u/1525481?v=3","gravatar_id":"","url":"https://api.github.com/users/timholy","html_url":"https://github.com/timholy","followers_url":"https://api.github.com/users/timholy/followers","following_url":"https://api.github.com/users/timholy/following{/other_user}","gists_url":"https://api.github.com/users/timholy/gists{/gist_id}","starred_url":"https://api.github.com/users/timholy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timholy/subscriptions","organizations_url":"https://api.github.com/users/timholy/orgs","repos_url":"https://api.github.com/users/timholy/repos","events_url":"https://api.github.com/users/timholy/events{/privacy}","received_events_url":"https://api.github.com/users/timholy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-08T15:48:32Z","updated_at":"2016-04-08T15:50:38Z","closed_at":null,"body":"Taken from the `edge.jl` tests in Images (this works in julia-0.4):\r\n```jl\r\nusing FactCheck\r\n\r\nfacts(\"Edge\") do\r\n    # Checkerboard array, used to test image gradients\r\n    white{T}(::Type{T}) = one(T)\r\n    black{T}(::Type{T}) = zero(T)\r\n    white{T<:Unsigned}(::Type{T}) = typemax(T)\r\n    black{T<:Unsigned}(::Type{T}) = typemin(T)\r\n\r\n    global checkerboard\r\n    function checkerboard{T}(::Type{T}, sq_width::Integer, count::Integer)\r\n        wh = fill(white(T), (sq_width,sq_width))\r\n        bk = fill(black(T), (sq_width,sq_width))\r\n        bw = [wh bk; bk wh]\r\n        vert = repmat(bw, (count>>1), 1)\r\n        isodd(count) && (vert = vcat(vert, [wh bk]))\r\n        cb = repmat(vert, 1, (count>>1))\r\n        isodd(count) && (cb = hcat(cb, vert[:,1:sq_width]))\r\n        cb\r\n    end\r\n\r\nend\r\n```\r\nCommenting out the `global`, or commenting out the FactCheck-specific lines, eliminates the segfault."},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/207489670","html_url":"https://github.com/JuliaLang/julia/issues/15809#issuecomment-207489670","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/15809","id":207489670,"user":{"login":"timholy","id":1525481,"avatar_url":"https://avatars.githubusercontent.com/u/1525481?v=3","gravatar_id":"","url":"https://api.github.com/users/timholy","html_url":"https://github.com/timholy","followers_url":"https://api.github.com/users/timholy/followers","following_url":"https://api.github.com/users/timholy/following{/other_user}","gists_url":"https://api.github.com/users/timholy/gists{/gist_id}","starred_url":"https://api.github.com/users/timholy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timholy/subscriptions","organizations_url":"https://api.github.com/users/timholy/orgs","repos_url":"https://api.github.com/users/timholy/repos","events_url":"https://api.github.com/users/timholy/events{/privacy}","received_events_url":"https://api.github.com/users/timholy/received_events","type":"User","site_admin":false},"created_at":"2016-04-08T15:50:38Z","updated_at":"2016-04-08T15:50:38Z","body":"Rats, hit comment before pasting in the backtrace:\r\n```\r\njulia> include(\"/tmp/segfault.jl\")\r\nEdge\r\n\r\nsignal (11): Segmentation fault\r\nwhile loading /tmp/segfault.jl, in expression starting on line 3\r\n[inline] at /home/tim/src/julia-0.5/src/jltypes.c:1694\r\nvalid_type_param at /home/tim/src/julia-0.5/src/jltypes.c:1738\r\n#1 at /tmp/segfault.jl:11\r\n[inline] at ./dict.jl:778\r\nfacts at /home/tim/.julia/v0.5/FactCheck/src/FactCheck.jl:449\r\nunknown function (ip: 0x7f588a6a8481)\r\n[inline] at /home/tim/src/julia-0.5/src/julia_internal.h:69\r\njl_call_method_internal at /home/tim/src/julia-0.5/src/gf.c:1872\r\ndo_call at /home/tim/src/julia-0.5/src/interpreter.c:59\r\neval at /home/tim/src/julia-0.5/src/interpreter.c:181\r\neval_body at /home/tim/src/julia-0.5/src/interpreter.c:529\r\njl_interpret_toplevel_thunk at /home/tim/src/julia-0.5/src/interpreter.c:537\r\njl_toplevel_eval_flex at /home/tim/src/julia-0.5/src/toplevel.c:552\r\njl_parse_eval_all at /home/tim/src/julia-0.5/src/ast.c:793\r\njl_load at /home/tim/src/julia-0.5/src/toplevel.c:577\r\ninclude at ./boot.jl:234\r\n[inline] at /home/tim/src/julia-0.5/src/julia_internal.h:69\r\njl_call_method_internal at /home/tim/src/julia-0.5/src/gf.c:1872\r\ninclude_from_node1 at ./loading.jl:417\r\nunknown function (ip: 0x7f5a8c486ca5)\r\n[inline] at /home/tim/src/julia-0.5/src/julia_internal.h:69\r\njl_call_method_internal at /home/tim/src/julia-0.5/src/gf.c:1872\r\ndo_call at /home/tim/src/julia-0.5/src/interpreter.c:59\r\neval at /home/tim/src/julia-0.5/src/interpreter.c:181\r\njl_toplevel_eval_flex at /home/tim/src/julia-0.5/src/toplevel.c:554\r\n[inline] at /home/tim/src/julia-0.5/src/julia.h:1396\r\njl_eh_restore_state at /home/tim/src/julia-0.5/src/builtins.c:542\r\neval at ./boot.jl:237\r\n[inline] at /home/tim/src/julia-0.5/src/julia_internal.h:69\r\njl_call_method_internal at /home/tim/src/julia-0.5/src/gf.c:1872\r\n[inline] at ./REPL.jl:3\r\neval_user_input at ./REPL.jl:62\r\nunknown function (ip: 0x7f5a917e5577)\r\n[inline] at /home/tim/src/julia-0.5/src/julia_internal.h:69\r\njl_call_method_internal at /home/tim/src/julia-0.5/src/gf.c:1872\r\n[inline] at ./REPL.jl:85\r\n#1 at ./event.jl:46\r\nunknown function (ip: 0x7f5a91822590)\r\n[inline] at /home/tim/src/julia-0.5/src/julia_internal.h:69\r\njl_call_method_internal at /home/tim/src/julia-0.5/src/gf.c:1872\r\nstart_task at /home/tim/src/julia-0.5/src/task.c:248\r\nAllocations: 4531872 (Pool: 4530263; Big: 1609); GC: 9\r\nSegmentation fault (core dumped)\r\n```\r\n"}}