Hi, On Wed, Dec 22, 2021 at 10:46 AM John Marriott <[email protected]> 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> >
This patch did not change the dictitem_T definition or modify the dict_add_tv() or the dictitem_alloc() functions. It looks like GCC is complaining about using the di_key buffer with size 1 (even though the size of the di_key array is greater than 1). Interestingly GCC is not complaining about the use of this function in other places. - Yegappan -- -- 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/CAAW7x7kWkMoPEX8Cm%2B0%2Bqcam9QrEOGdgDxPxFyU%3DNRs3N%2BGRhA%40mail.gmail.com.
