Patch 8.2.2389

9 views
Skip to first unread message

Bram Moolenaar

unread,
Jan 21, 2021, 4:54:15 PM1/21/21
to vim...@googlegroups.com

Patch 8.2.2389
Problem: Test failure on a few systems.
Solution: Avoid that "char" value is negative.
Files: src/vim9compile.c, src/vim9execute.c, src/vim9.h


*** ../vim-8.2.2388/src/vim9compile.c 2021-01-21 20:21:24.240670466 +0100
--- src/vim9compile.c 2021-01-21 22:51:00.019353529 +0100
***************
*** 826,832 ****
if ((isn = generate_instr(cctx, ISN_CHECKTYPE)) == NULL)
return FAIL;
isn->isn_arg.type.ct_type = alloc_type(expected);
! isn->isn_arg.type.ct_off = offset;
isn->isn_arg.type.ct_arg_idx = argidx;

// type becomes expected
--- 826,834 ----
if ((isn = generate_instr(cctx, ISN_CHECKTYPE)) == NULL)
return FAIL;
isn->isn_arg.type.ct_type = alloc_type(expected);
! // Use the negated offset so that it's always positive. Some systems don't
! // support negative numbers for "char".
! isn->isn_arg.type.ct_off = (char)-offset;
isn->isn_arg.type.ct_arg_idx = argidx;

// type becomes expected
*** ../vim-8.2.2388/src/vim9execute.c 2021-01-21 20:21:24.244670457 +0100
--- src/vim9execute.c 2021-01-21 22:50:11.995525764 +0100
***************
*** 3240,3246 ****
{
checktype_T *ct = &iptr->isn_arg.type;

! tv = STACK_TV_BOT(ct->ct_off);
SOURCING_LNUM = iptr->isn_lnum;
if (check_typval_type(ct->ct_type, tv, ct->ct_arg_idx)
== FAIL)
--- 3240,3246 ----
{
checktype_T *ct = &iptr->isn_arg.type;

! tv = STACK_TV_BOT(-(int)ct->ct_off);
SOURCING_LNUM = iptr->isn_lnum;
if (check_typval_type(ct->ct_type, tv, ct->ct_arg_idx)
== FAIL)
***************
*** 4242,4252 ****
if (ct->ct_arg_idx == 0)
smsg("%4d CHECKTYPE %s stack[%d]", current,
type_name(ct->ct_type, &tofree),
! (int)ct->ct_off);
else
smsg("%4d CHECKTYPE %s stack[%d] arg %d", current,
type_name(ct->ct_type, &tofree),
! (int)ct->ct_off,
(int)ct->ct_arg_idx);
vim_free(tofree);
break;
--- 4242,4252 ----
if (ct->ct_arg_idx == 0)
smsg("%4d CHECKTYPE %s stack[%d]", current,
type_name(ct->ct_type, &tofree),
! -(int)ct->ct_off);
else
smsg("%4d CHECKTYPE %s stack[%d] arg %d", current,
type_name(ct->ct_type, &tofree),
! -(int)ct->ct_off,
(int)ct->ct_arg_idx);
vim_free(tofree);
break;
*** ../vim-8.2.2388/src/vim9.h 2021-01-21 20:21:24.240670466 +0100
--- src/vim9.h 2021-01-21 22:50:33.903447037 +0100
***************
*** 224,230 ****
// arguments to ISN_CHECKTYPE
typedef struct {
type_T *ct_type;
! char ct_off; // offset in stack, -1 is bottom
char ct_arg_idx; // argument index or zero
} checktype_T;

--- 224,230 ----
// arguments to ISN_CHECKTYPE
typedef struct {
type_T *ct_type;
! char ct_off; // offset in stack (positive), 1 is bottom
char ct_arg_idx; // argument index or zero
} checktype_T;

*** ../vim-8.2.2388/src/version.c 2021-01-21 21:42:09.409150461 +0100
--- src/version.c 2021-01-21 22:53:13.186881998 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2389,
/**/

--
panic("Foooooooood fight!");
-- In the kernel source aha1542.c, after detecting a bad segment list

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

James McCoy

unread,
Jan 22, 2021, 8:43:56 AM1/22/21
to vim_dev
On Thu, Jan 21, 2021, 16:54 Bram Moolenaar <Br...@moolenaar.net> wrote:

Patch 8.2.2389
Problem:    Test failure on a few systems.
Solution:   Avoid that "char" value is negative.
Files:      src/vim9compile.c, src/vim9execute.c, src/vim9.h


*** ../vim-8.2.2388/src/vim9compile.c   2021-01-21 20:21:24.240670466 +0100
--- src/vim9compile.c   2021-01-21 22:51:00.019353529 +0100
***************
*** 826,832 ****
      if ((isn = generate_instr(cctx, ISN_CHECKTYPE)) == NULL)
        return FAIL;
      isn->isn_arg.type.ct_type = alloc_type(expected);
!     isn->isn_arg.type.ct_off = offset;
      isn->isn_arg.type.ct_arg_idx = argidx;

      // type becomes expected
--- 826,834 ----
      if ((isn = generate_instr(cctx, ISN_CHECKTYPE)) == NULL)
        return FAIL;
      isn->isn_arg.type.ct_type = alloc_type(expected);
!     // Use the negated offset so that it's always positive.  Some systems don't
!     // support negative numbers for "char".
!     isn->isn_arg.type.ct_off = (char)-offset;

Or is it that whether char is signed or not depends on the system?  There's an int8_T typedef in Vim just for this type of code.

Cheers,
James

Bram Moolenaar

unread,
Jan 22, 2021, 12:12:46 PM1/22/21
to vim...@googlegroups.com, James McCoy
Forgot about that. Let's change it, the positive offset is a bit weird.

--
hundred-and-one symptoms of being an internet addict:
203. You're an active member of more than 20 newsgroups.
Reply all
Reply to author
Forward
0 new messages