Re: Patch 8.2.1880

2020-10-21 Fir de Conversatie Bram Moolenaar


John Marriott wrote:

> On 22-Oct-2020 01:50, Bram Moolenaar wrote:
> > Patch 8.2.1880
> > Problem:Vim9: Asan complains about adding zero to NULL.
> > Solution:   Check for argument count first.
> > Files:  src/vim9compile.c
> >
> >
> >
> After this patch mingw64 (gcc 10.2) throws this warning:
> 
> gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 
> -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO 
> -pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return 
> -fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD vim9compile.c -o 
> gobjnative/vim9compile.o
> vim9compile.c: In function 'compile_call':
> vim9compile.c:1496:6: warning: 'argtypes' may be used uninitialized in 
> this function [-Wmaybe-uninitialized]
>   1496 |  internal_func_ret_type(func_idx, argcount, argtypes);
>    |  ^~~~
> vim9compile.c:1463:14: note: 'argtypes' was declared here
>   1463 | type_T **argtypes;
>    |  ^~~~
> 
> 
> Not sure what the fix should be. Perhaps as simple as initialising 
> argtypes to NULL?

Using NULL should work.

-- 
Contrary to popular belief, Unix is user friendly.
It just happens to be selective about who it makes friends with.
   -- Dave Parnas

 /// Bram Moolenaar -- b...@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///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202010212037.09LKbjJ4175081%40masaka.moolenaar.net.


Re: Patch 8.2.1880

2020-10-21 Fir de Conversatie John Marriott



On 22-Oct-2020 01:50, Bram Moolenaar wrote:

Patch 8.2.1880
Problem:Vim9: Asan complains about adding zero to NULL.
Solution:   Check for argument count first.
Files:  src/vim9compile.c




After this patch mingw64 (gcc 10.2) throws this warning:

gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 
-DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO 
-pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return 
-fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD vim9compile.c -o 
gobjnative/vim9compile.o

vim9compile.c: In function 'compile_call':
vim9compile.c:1496:6: warning: 'argtypes' may be used uninitialized in 
this function [-Wmaybe-uninitialized]

 1496 |  internal_func_ret_type(func_idx, argcount, argtypes);
  |  ^~~~
vim9compile.c:1463:14: note: 'argtypes' was declared here
 1463 | type_T **argtypes;
  |  ^~~~


Not sure what the fix should be. Perhaps as simple as initialising 
argtypes to NULL?


Cheers
John

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups "vim_dev" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/8456d43f-f5ae-a41e-ff02-c777f9e9de89%40internode.on.net.


Patch 8.2.1880

2020-10-21 Fir de Conversatie Bram Moolenaar


Patch 8.2.1880
Problem:Vim9: Asan complains about adding zero to NULL.
Solution:   Check for argument count first.
Files:  src/vim9compile.c


*** ../vim-8.2.1879/src/vim9compile.c   2020-10-21 16:42:18.517821898 +0200
--- src/vim9compile.c   2020-10-21 16:47:57.057129882 +0200
***
*** 1475,1485 
isn->isn_arg.shuffle.shfl_up = argoff - 1;
  }
  
! // Check the types of the arguments.
! argtypes = ((type_T **)stack->ga_data) + stack->ga_len - argcount;
! if (argcount > 0 && internal_func_check_arg_types(
!   argtypes, func_idx, argcount) == FAIL)
return FAIL;
  
  if ((isn = generate_instr(cctx, ISN_BCALL)) == NULL)
return FAIL;
--- 1475,1487 
isn->isn_arg.shuffle.shfl_up = argoff - 1;
  }
  
! if (argcount > 0)
! {
!   // Check the types of the arguments.
!   argtypes = ((type_T **)stack->ga_data) + stack->ga_len - argcount;
!   if (internal_func_check_arg_types(argtypes, func_idx, argcount) == FAIL)
return FAIL;
+ }
  
  if ((isn = generate_instr(cctx, ISN_BCALL)) == NULL)
return FAIL;
*** ../vim-8.2.1879/src/version.c   2020-10-21 16:42:18.517821898 +0200
--- src/version.c   2020-10-21 16:48:57.637012434 +0200
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 1880,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
96. On Super Bowl Sunday, you followed the score by going to the
Yahoo main page instead of turning on the TV.

 /// Bram Moolenaar -- b...@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///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202010211450.09LEoDTE072573%40masaka.moolenaar.net.