all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Warnings in mingw64 build on emacs-28 branch
@ 2021-11-07 14:46 Andy Moreton
  2021-11-07 15:05 ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Andy Moreton @ 2021-11-07 14:46 UTC (permalink / raw)
  To: emacs-devel

Hi,

There are currently some warnings on the emacs-28 branch when building
with 64bit mingw64 on Windows (gcc 11.2.0).


1) In w32.h, "prepare_standard_handles" and "reset_standard_handles"
have "HANDLE handles[4]" argument, but the handle array has 3 elements
in the definitions and callers.

In function 'child_setup',
    inlined from 'emacs_spawn' at C:/emacs/git/emacs/emacs-28/src/callproc.c:1408:13:
C:/emacs/git/emacs/emacs-28/src/callproc.c:1213:3: warning: 'prepare_standard_handles' accessing 32 bytes in a region of size 24 [-Wstringop-overflow=]
 1213 |   prepare_standard_handles (in, out, err, handles);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/emacs/git/emacs/emacs-28/src/callproc.c: In function 'emacs_spawn':
C:/emacs/git/emacs/emacs-28/src/callproc.c:1213:3: note: referencing argument 4 of type 'void **'
In file included from C:/emacs/git/emacs/emacs-28/nt/inc/sys/socket.h:82,
                 from C:/emacs/git/emacs/emacs-28/src/thread.h:25,
                 from C:/emacs/git/emacs/emacs-28/src/lisp.h:2162,
                 from C:/emacs/git/emacs/emacs-28/src/callproc.c:31:
C:/emacs/git/emacs/emacs-28/src/w32.h:157:13: note: in a call to function 'prepare_standard_handles'
  157 | extern void prepare_standard_handles (int in, int out,
      |             ^~~~~~~~~~~~~~~~~~~~~~~~
In function 'child_setup',
    inlined from 'emacs_spawn' at C:/emacs/git/emacs/emacs-28/src/callproc.c:1408:13:
C:/emacs/git/emacs/emacs-28/src/callproc.c:1217:3: warning: 'reset_standard_handles' accessing 32 bytes in a region of size 24 [-Wstringop-overflow=]
 1217 |   reset_standard_handles (in, out, err, handles);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/emacs/git/emacs/emacs-28/src/callproc.c: In function 'emacs_spawn':
C:/emacs/git/emacs/emacs-28/src/callproc.c:1217:3: note: referencing argument 4 of type 'void **'
In file included from C:/emacs/git/emacs/emacs-28/nt/inc/sys/socket.h:82,
                 from C:/emacs/git/emacs/emacs-28/src/thread.h:25,
                 from C:/emacs/git/emacs/emacs-28/src/lisp.h:2162,
                 from C:/emacs/git/emacs/emacs-28/src/callproc.c:31:
C:/emacs/git/emacs/emacs-28/src/w32.h:161:13: note: in a call to function 'reset_standard_handles'
  161 | extern void reset_standard_handles (int in, int out,
      |             ^~~~~~~~~~~~~~~~~~~~~~


2) This warning has been present for a long time, and seems to be
confusion over the flexible array handling.

C:/emacs/git/emacs/emacs-28/src/w32menu.c: In function 'set_frame_menubar':
C:/emacs/git/emacs/emacs-28/src/w32menu.c:324:9: warning: 'memcpy' offset [3, 10] from the object at '<unknown>' is out of the bounds of referenced subobject 'contents' with type 'struct Lisp_X *[]' at offset 3 [-Warray-bounds]
  324 |         memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents,
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  325 |                 previous_menu_items_used * word_size);
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/emacs/git/emacs/emacs-28/src/w32menu.c:26:
C:/emacs/git/emacs/emacs-28/src/lisp.h:1638:17: note: subobject 'contents' declared here
 1638 |     Lisp_Object contents[FLEXIBLE_ARRAY_MEMBER];
      |                 ^~~~~~~~

3) This warning is new with gcc 11.

C:/emacs/git/emacs/emacs-28/src/w32heap.c: In function 'getrlimit':
C:/emacs/git/emacs/emacs-28/src/w32heap.c:853:14: warning: 'm' may be used uninitialized [-Wmaybe-uninitialized]
  853 |         if (!VirtualQuery ((LPCVOID) &m, &m, sizeof m))
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/msys64/mingw64/x86_64-w64-mingw32/include/winbase.h:25,
                 from C:/msys64/mingw64/x86_64-w64-mingw32/include/windows.h:70,
                 from C:/emacs/git/emacs/emacs-28/src/w32common.h:24,
                 from C:/emacs/git/emacs/emacs-28/src/w32heap.c:54:
C:/msys64/mingw64/x86_64-w64-mingw32/include/memoryapi.h:45:28: note: by argument 1 of type 'LPCVOID' {aka 'const void *'} to 'VirtualQuery' declared here
   45 |   WINBASEAPI SIZE_T WINAPI VirtualQuery (LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength);
      |                            ^~~~~~~~~~~~
C:/emacs/git/emacs/emacs-28/src/w32heap.c:844:34: note: 'm' declared here
  844 |         MEMORY_BASIC_INFORMATION m;
      |                                  ^




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-11-07 20:55 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-07 14:46 Warnings in mingw64 build on emacs-28 branch Andy Moreton
2021-11-07 15:05 ` Eli Zaretskii
2021-11-07 15:51   ` Óscar Fuentes
2021-11-07 18:39     ` Eli Zaretskii
2021-11-07 19:25       ` Óscar Fuentes
2021-11-07 19:30         ` Eli Zaretskii
2021-11-07 19:57           ` Óscar Fuentes
2021-11-07 20:02             ` Eli Zaretskii
2021-11-07 18:07   ` Andy Moreton
2021-11-07 19:41     ` Andy Moreton
2021-11-07 19:59       ` Eli Zaretskii
2021-11-07 20:55         ` Andy Moreton

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.