On 07-June-2022 07:15, Bram Moolenaar wrote:
John Marriott wrote:

I just moved up to mingw64 with gcc 12.1.0 on my windows 8.1 x64 box.

I now have two warnings. The first:
<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 ui.c -o gobjnative/ui.o
In file included from ui.c:18:
In function 'read_from_input_buf',
      inlined from 'inchar_loop' at ui.c:396:12:
vim.h:1776:37: warning: 'memmove' offset [-2147483647, -1] is out of the
bounds [0, 256] of object 'inbuf' with type 'char_u[256]' {aka 'unsigned
char[256]'} [-Warray-bounds]
   1776 | # define mch_memmove(to, from, len) memmove((char*)(to),
(char*)(from), (size_t)(len))
        | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim.h:1776:37: note: in definition of macro 'mch_memmove'
   1776 | # define mch_memmove(to, from, len) memmove((char*)(to),
(char*)(from), (size_t)(len))
        |                                     ^~~~~~~
ui.c: In function 'inchar_loop':
ui.c:750:17: note: 'inbuf' declared here
    750 | static char_u   inbuf[INBUFLEN + MAX_KEY_CODE_LEN];
        |                 ^~~~~
</snip>
No idea what's wrong here, probably nothing.
The attached patch shuts gcc 12.1 up.

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/4f178c98-085a-4bb6-4e2d-d84a286f1678%40internode.on.net.
--- ui.c.orig   2022-05-10 05:59:19.635047500 +1000
+++ ui.c        2022-06-10 07:28:20.750625000 +1000
@@ -897,7 +897,7 @@
        maxlen = inbufcount;
     mch_memmove(buf, inbuf, (size_t)maxlen);
     inbufcount -= maxlen;
-    if (inbufcount)
+    if (inbufcount > 0 && maxlen > 0)
        mch_memmove(inbuf, inbuf + maxlen, (size_t)inbufcount);
     return (int)maxlen;
 }

Raspunde prin e-mail lui