Yegappan Lakshmanan
unread,Mar 13, 2021, 11:21:58 AM3/13/21Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to vim_dev
Hi,
I am seeing a Vim (8.2.2590) crash with my vim9 LSP plugin
when a variable declaration is moved inside a try statement.
A fragment of a function that causes the crash is below:
def ProcessMessages(lspserver: dict<any>): void
try
var msg = content->json_decode()
catch
continue
endtry
if msg->has_key('result') || msg->has_key('error')
endif
enddef
In the above fragment of code the variable 'msg' is declared
inside the try block but is accessed outside of the block.
If the variable declaration is moved outside the try block, then
Vim doesn't crash.
I am not able to reproduce this using a simplified function.
The crash traceback is below.
Regards,
Yegappan
Program received signal SIGSEGV, Segmentation fault.
equal_type (type1=type1@entry=0x0, type2=type2@entry=0x5555558a3930 <t_any>)
at vim9type.c:922
922 if (type1->tt_type != type2->tt_type)
(gdb) bt
#0 equal_type
(type1=type1@entry=0x0, type2=type2@entry=0x5555558a3930 <t_any>)
at vim9type.c:922
#1 0x00005555557914db in common_type
(type_gap=0x7fffffffbd20, dest=0x7fffffffbcb0,
type2=0x5555558a3930 <t_any>, type1=0x0) at vim9type.c:964
#2 typval2type_int
(tv=tv@entry=0x7fffffffbe00, type_gap=type_gap@entry=0x7fffffffbd20)
at vim9type.c:302
#3 0x0000555555791e6c in typval2type
(type_gap=0x7fffffffbd20, tv=0x7fffffffbe00) at vim9type.c:424
#4 check_typval_type
(expected=expected@entry=0x5555558a3d60 <t_dict_any>,
actual_tv=actual_tv@entry=0x7fffffffbe00, where=...) at vim9type.c:424
#5 0x0000555555791f13 in check_typval_arg_type
(expected=expected@entry=0x5555558a3d60 <t_dict_any>,
actual_tv=actual_tv@entry=0x7fffffffbe00, arg_idx=arg_idx@entry=2) at
vim9type.c:409
#6 0x000055555565dfa1 in extend
(argvars=0x7fffffffbdf0, rettv=0x555555b3cbc0,
arg_errmsg=<optimized out>, is_new=0) at list.c:2666
#7 0x0000555555786c39 in call_bfunc
(func_idx=105, argcount=2, ectx=ectx@entry=0x7fffffffc040)
at vim9execute.c:663
#8 0x000055555578cbb8 in call_def_function
(ufunc=ufunc@entry=0x555555b23040, argc_arg=argc_arg@entry=1,
argv=argv@entry=0x7fffffffd1f0, partial=<optimized out>,
rettv=rettv@entry=0x7fffffffd3c0)
at vim9execute.c:2469
#9 0x0000555555774027 in call_user_func
(fp=fp@entry=0x555555b23040, argcount=argcount@entry=1,
argvars=argvars@entry=0x7fffffffd1f0,
rettv=rettv@entry=0x7fffffffd3c0, funcexe=funcexe@entry=
0x7fffffffd440, selfdict=selfdict@entry=0x0) at userfunc.c:1673
#10 0x00005555557746cb in call_user_func_check
(selfdict=<optimized out>, funcexe=
0x7fffffffd440, rettv=0x7fffffffd3c0, argvars=0x7fffffffd1f0,
argcount=1, fp=0x555555b23040) at userfunc.c:2061
#11 call_user_func_check
(fp=0x555555b23040, argcount=1, argvars=0x7fffffffd1f0,
rettv=0x7fffffffd3c0, funcexe=0x7fffffffd440, selfdict=<optimized
out>) at userfunc.c:2027
#12 0x0000555555774bbd in call_func
(funcname=funcname@entry=0x555555b32770 "lsp#addServer",
len=len@entry=-1, rettv=rettv@entry=0x7fffffffd3c0,
argcount_in=argcount_in@entry=1,
argvars_in=argvars_in@entry=0x7fffffffd1f0,
funcexe=funcexe@entry=0x7fffffffd440)
at userfunc.c:2527
#13 0x00005555557751df in get_func_tv
(name=name@entry=0x555555b32770 "lsp#addServer", len=len@entry=-1,
rettv=rettv@entry=0x7fffffffd3c0, arg=arg@entry=0x7fffffffd3a8,
evalarg=evalarg@entry=0x7fffffffd3f0,
funcexe=funcexe@entry=0x7fffffffd440) at userfunc.c:932
#14 0x000055555577589c in ex_call (eap=0x7fffffffd650) at userfunc.c:4513
#15 0x000055555561297b in do_one_cmd (cookie=0x7fffffffdf00, fgetline=
0x555555700c60 <getsourceline>, cstack=0x7fffffffd800, flags=7,
cmdlinep=0x7fffffffd5b0) at ex_docmd.c:2591
#16 do_cmdline
(cmdline=cmdline@entry=0x5555558b8060 "set nocp", fgetline=fgetline@entry=
0x555555700c60 <getsourceline>,
cookie=cookie@entry=0x7fffffffdf00, flags=flags@entry=7) at
ex_docmd.c:1000
#17 0x0000555555702840 in do_source
(fname=0x5555558101b1 "$HOME/.vimrc", check_other=<optimized out>,
is_vimrc=<optimized out>, ret_sid=0x0) at scriptfile.c:1404
#18 0x0000555555594f33 in source_startup_scripts
(parmp=0x5555558b0580 <params>) at main.c:3155
#19 main (argc=<optimized out>, argv=<optimized out>) at main.c:400