John Marriott wrote:

> On 23-Dec-2021 05:20, Bram Moolenaar wrote:
> > Patch 8.2.3871
> > Problem:    List.c contains code for dict and blob.
> > Solution:   Refactor to put code where it belongs. (Yegappan Lakshmanan,
> >              closes #9386)
> > Files:      src/blob.c, src/dict.c, src/list.c, src/proto/blob.pro,
> >              src/proto/dict.pro, src/proto/list.pro, src/proto/strings.pro,
> >              src/strings.c, src/structs.h, src/testdir/test_filter_map.vim,
> >              src/testdir/test_listdict.vim, src/testdir/test_sort.vim
> >
> >
> After this patch, mingw64 (gcc 11.2.0) spits out this warning:
> <snip>
> 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 dict.c -o gobjnative/dict.o
> In file included from dict.c:14:
> In function 'dictitem_alloc',
>      inlined from 'dict_add_tv' at dict.c:491:12,
>      inlined from 'dict_filter_map' at dict.c:1370:7:
> vim.h:1629:29: warning: 'strcpy' offset 0 from the object at '<unknown>' 
> is out of the bounds of referenced subobject 'di_key' with type 
> 'char_u[1]' {aka 'unsigned char[1]'} at offset 0 [-Warray-bounds]
>   1629 | #define STRCPY(d, s)        strcpy((char *)(d), (char *)(s))
>        |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> vim.h:1629:29: note: in definition of macro 'STRCPY'
>   1629 | #define STRCPY(d, s)        strcpy((char *)(d), (char *)(s))
>        |                             ^~~~~~
> In file included from vim.h:1878,
>                   from dict.c:14:
> dict.c: In function 'dict_filter_map':
> structs.h:1538:17: note: subobject 'di_key' declared here
>   1538 |     char_u      di_key[1];      // key (actually longer!)
>        |                 ^~~~~~
> </snip>

Is that because of the "actually longer" thing?
Any idea how to avoid the error?

-- 
>From "know your smileys":
 <<<:-{    Worf (Never smiles anyways, so he's a bad smiley)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20211222191935.349F41C0641%40moolenaar.net.

Raspunde prin e-mail lui