emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Warnings in mingw64 build on emacs-28 branch


From: Andy Moreton
Subject: Warnings in mingw64 build on emacs-28 branch
Date: Sun, 07 Nov 2021 14:46:51 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (windows-nt)

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;
      |                                  ^




reply via email to

[Prev in Thread] Current Thread [Next in Thread]