To: vim_dev@googlegroups.com Subject: Patch 9.0.1363 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1363 Problem: Crash when :def function has :break in skipped block. (Ernie Rael) Solution: Don't generate a jump for a skipped :break. (closes #12077) Files: src/vim9cmds.c, src/testdir/test_vim9_func.vim *** ../vim-9.0.1362/src/vim9cmds.c 2023-01-30 21:12:30.547422897 +0000 --- src/vim9cmds.c 2023-02-27 22:05:37.493037476 +0000 *************** *** 1440,1445 **** --- 1440,1448 ---- e_break_without_while_or_for, cctx) == FAIL) return NULL; + if (cctx->ctx_skip == SKIP_YES) + return arg; + if (try_scopes > 0) // Inside one or more try/catch blocks we first need to jump to the // "finally" or "endtry" to cleanup. Then come to the next JUMP *************** *** 1449,1455 **** // Jump to the end of the FOR or WHILE loop. The instruction index will be // filled in later. if (compile_jump_to_end(el, JUMP_ALWAYS, 0, cctx) == FAIL) ! return FAIL; return arg; } --- 1452,1458 ---- // Jump to the end of the FOR or WHILE loop. The instruction index will be // filled in later. if (compile_jump_to_end(el, JUMP_ALWAYS, 0, cctx) == FAIL) ! return NULL; return arg; } *** ../vim-9.0.1362/src/testdir/test_vim9_func.vim 2023-01-28 19:18:56.737720609 +0000 --- src/testdir/test_vim9_func.vim 2023-02-27 22:04:52.693083637 +0000 *************** *** 166,171 **** --- 166,196 ---- delfunc g:Define enddef + def Test_break_in_skipped_block() + var lines =<< trim END + vim9script + + def FixStackFrame(): string + for _ in [2] + var path = 'xxx' + if !!path + if false + break + else + return 'foo' + endif + endif + endfor + return 'xxx' + enddef + + disas FixStackFrame + + FixStackFrame() + END + v9.CheckScriptSuccess(lines) + enddef + def Test_autoload_name_mismatch() var dir = 'Xnamedir/autoload' mkdir(dir, 'pR') *** ../vim-9.0.1362/src/version.c 2023-02-27 17:17:57.750253721 +0000 --- src/version.c 2023-02-27 22:01:39.573332813 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1363, /**/ -- hundred-and-one symptoms of being an internet addict: 191. You rate eating establishments not by the quality of the food, but by the availability of electrical outlets for your PowerBook. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///