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.
This is probably a better patch.
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/1ae1e9e4-ff32-a09f-d27b-71df260585f3%40internode.on.net.
--- ui.c.orig 2022-05-10 05:59:19.635047500 +1000
+++ ui.c 2022-06-10 14:07:53.256663900 +1000
@@ -898,7 +898,7 @@
mch_memmove(buf, inbuf, (size_t)maxlen);
inbufcount -= maxlen;
if (inbufcount)
- mch_memmove(inbuf, inbuf + maxlen, (size_t)inbufcount);
+ mch_memmove(inbuf, inbuf + ((maxlen < 0) ? 0 : maxlen),
(size_t)inbufcount);
return (int)maxlen;
}