{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/13321","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/13321/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/13321/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/13321/events","html_url":"https://github.com/JuliaLang/julia/issues/13321","id":108421824,"number":13321,"title":"SegFault in inference0.ji compilation on master for ARM","user":{"login":"yuyichao","id":712232,"avatar_url":"https://avatars.githubusercontent.com/u/712232?v=3","gravatar_id":"","url":"https://api.github.com/users/yuyichao","html_url":"https://github.com/yuyichao","followers_url":"https://api.github.com/users/yuyichao/followers","following_url":"https://api.github.com/users/yuyichao/following{/other_user}","gists_url":"https://api.github.com/users/yuyichao/gists{/gist_id}","starred_url":"https://api.github.com/users/yuyichao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuyichao/subscriptions","organizations_url":"https://api.github.com/users/yuyichao/orgs","repos_url":"https://api.github.com/users/yuyichao/repos","events_url":"https://api.github.com/users/yuyichao/events{/privacy}","received_events_url":"https://api.github.com/users/yuyichao/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JuliaLang/julia/labels/arm","name":"arm","color":"fbca04"},{"url":"https://api.github.com/repos/JuliaLang/julia/labels/codegen","name":"codegen","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-09-25T23:10:38Z","updated_at":"2015-09-26T07:28:42Z","closed_at":null,"body":"I get a segfault very early in the bootstrap when compiling the current master for 32bit ARM with stock LLVM 3.6.2. Happens with both qemu and native compilation.\r\n\r\nBacktrace is\r\n\r\n```c\r\n#0  0xb62d45b8 in jl_f_new_expr (F=<optimized out>, args=0xbefff254, nargs=3)\r\n    at /home/yuyichao/julia/src/alloc.c:879\r\n#1  0xb6ff60e8 in julia.new_0 ()\r\n#2  0xb62787b4 in jl_apply (nargs=2, args=0xbefff2cc, f=<optimized out>)\r\n    at /home/yuyichao/julia/src/julia.h:1328\r\n#3  jl_apply_generic (F=0x95339680, args=0xbefff2cc, nargs=2)\r\n    at /home/yuyichao/julia/src/gf.c:1708\r\n#4  0xb62d1260 in jl_apply (nargs=2, args=0xbefff2cc, f=0x95339680)\r\n    at /home/yuyichao/julia/src/julia.h:1328\r\n#5  do_call (f=0x95339680, args=args@entry=0x9533c974, nargs=nargs@entry=2, \r\n    eval0=eval0@entry=0x0, locals=locals@entry=0x0, nl=nl@entry=0, \r\n    ngensym=ngensym@entry=0) at /home/yuyichao/julia/src/interpreter.c:65\r\n#6  0xb62d03c0 in eval (e=<optimized out>, locals=locals@entry=0x0, \r\n    nl=nl@entry=0, ngensym=ngensym@entry=0)\r\n    at /home/yuyichao/julia/src/interpreter.c:213\r\n#7  0xb62d1170 in jl_interpret_toplevel_expr (e=<optimized out>)\r\n    at /home/yuyichao/julia/src/interpreter.c:27\r\n#8  0xb62e6934 in jl_toplevel_eval_flex (e=<optimized out>, fast=fast@entry=1)\r\n    at /home/yuyichao/julia/src/toplevel.c:527\r\n#9  0xb62e7734 in jl_toplevel_eval_flex (fast=1, e=<optimized out>)\r\n    at /home/yuyichao/julia/src/toplevel.c:573\r\n#10 jl_parse_eval_all (fname=fname@entry=0xb6d63a50 \"boot.jl\", len=len@entry=8)\r\n    at /home/yuyichao/julia/src/toplevel.c:577\r\n#11 0xb62e7970 in jl_load (fname=0xb6d63a50 \"boot.jl\", len=len@entry=8)\r\n    at /home/yuyichao/julia/src/toplevel.c:617\r\n#12 0xb62d73c8 in _julia_init (rel=<optimized out>)\r\n    at /home/yuyichao/julia/src/init.c:549\r\n#13 0xb62d8284 in julia_init (rel=<optimized out>)\r\n    at /home/yuyichao/julia/src/task.c:260\r\n#14 0x00011188 in main (argc=1, argv=0xbefffc1c)\r\n    at /home/yuyichao/julia/ui/repl.c:594\r\n```\r\n\r\nThe direct cause of the SegFault is that the first parameter (`args[0]`) to `jl_f_new_expr` is `NULL`.\r\nThis happens in the call `_new(:LabelNode, :Int)` in `boot.jl` (which is the `#3` in the backtrace)\r\n\r\nThe `jl_f_new_expr` is called from `julia.new_0` and the llvm ir can be find [here](https://gist.github.com/yuyichao/c3f9fc9dfdf1010a5b55#file-_new-ll), the dump of `jl_Module` right after codegen in `to_function()` is also [available](https://gist.github.com/yuyichao/c3f9fc9dfdf1010a5b55#file-_new-module-ll)\r\n\r\n~~AFAICT, the first argument should be `*'jl_sym#curly5'` and I've verified in GDB that this is indeed `0`. A list of global symbols recognized by gdb is here and AFAIK none of them looks right.~~ The dereference is wrong here but it seems that this is [exactly the mistake we are making in codegen](https://github.com/JuliaLang/julia/issues/13321#issuecomment-143385886).\r\n\r\n```\r\n(gdb) p jl_(*'jl_sym#::4')\r\n:fastmath                                                                         \r\n$4 = void                                                                         \r\n(gdb) p jl_(*'jl_sym#=1')\r\n:Base\r\n$5 = void\r\n(gdb) p jl_(*'jl_sym#Type6')\r\n:parameters\r\n$6 = void\r\n(gdb) p jl_(*'jl_sym#block8')\r\n:flags\r\n$7 = void\r\n(gdb) p jl_(*'jl_sym#call2')\r\n:meta\r\n$8 = void\r\n(gdb) p jl_(*'jl_sym#curly5')\r\n#<null>\r\n$9 = void\r\n(gdb) p jl_(*'jl_sym#n7')\r\n#<null>\r\n$10 = void\r\n(gdb) p jl_(*'jl_sym#new12')\r\n:item\r\n$11 = void\r\n```\r\n\r\nThis only happens on master and not release-0.4 so @vtjnash \r\n\r\nAlso @ViralBShah if you can reproduce this too.\r\n"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/143406382","html_url":"https://github.com/JuliaLang/julia/issues/13321#issuecomment-143406382","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/13321","id":143406382,"user":{"login":"ViralBShah","id":744411,"avatar_url":"https://avatars.githubusercontent.com/u/744411?v=3","gravatar_id":"","url":"https://api.github.com/users/ViralBShah","html_url":"https://github.com/ViralBShah","followers_url":"https://api.github.com/users/ViralBShah/followers","following_url":"https://api.github.com/users/ViralBShah/following{/other_user}","gists_url":"https://api.github.com/users/ViralBShah/gists{/gist_id}","starred_url":"https://api.github.com/users/ViralBShah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ViralBShah/subscriptions","organizations_url":"https://api.github.com/users/ViralBShah/orgs","repos_url":"https://api.github.com/users/ViralBShah/repos","events_url":"https://api.github.com/users/ViralBShah/events{/privacy}","received_events_url":"https://api.github.com/users/ViralBShah/received_events","type":"User","site_admin":false},"created_at":"2015-09-26T07:28:42Z","updated_at":"2015-09-26T07:28:42Z","body":"I was able to build with LLVM 3.6.1 and 3.7.0 on my chromebook, and everything seems to be the same as before. "}}