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.
I don't know either.
tee.c:122:24: warning: argument 1 range [18446744071562067968,
18446744073709551615] exceeds maximum object size 9223372036854775807
[-Walloc-size-larger-than=]
122 | filepointers = calloc(numfiles, sizeof(FILE *));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from tee.c:33:
d:\users\john\documents\software\mingw\mingw64\x86_64-w64-mingw32\include\malloc.h:57:17:
note: in a call to allocation function 'calloc' declared here
57 | void *__cdecl calloc(size_t _NumOfElements,size_t
_SizeOfElements);
| ^~~~~~
</snip>
No idea.
The attached patch seems to fix it.
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/ced94114-cc42-c995-0ffb-639d3eb6bab8%40internode.on.net.
--- tee.c.orig 2022-06-07 07:17:03.103963000 +1000
+++ tee.c 2022-06-08 05:56:58.200364300 +1000
@@ -82,7 +82,7 @@
main(int argc, char *argv[])
{
int append = 0;
- int numfiles;
+ size_t numfiles;
int maxfiles;
FILE **filepointers;
int i;
@@ -121,7 +121,7 @@
filepointers = calloc(numfiles, sizeof(FILE *));
if (filepointers == NULL)
{
- fprintf(stderr, "Error allocating memory for %d files\n",
numfiles);
+ fprintf(stderr, "Error allocating memory for %lld files\n",
numfiles);
exit(1);
}
for (i = 0; i < numfiles; i++)