Subject: bug#54694: 29.0.50; w32menu.o set_frame_menubar warning building on win32

From: Corwin Brust <[email-masked]>
Date: Sun, 3 Apr 2022 11:15:26 -0500

CC       image.o
C:/Users/corwi/emacs-build/git/master/src/w32menu.c: In function
'set_frame_menubar':
C:/Users/corwi/emacs-build/git/master/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:/Users/corwi/emacs-build/git/master/src/w32menu.c:26:
C:/Users/corwi/emacs-build/git/master/src/lisp.h:1725:17: note:
subobject 'contents' declared here
 1725 |     Lisp_Object contents[FLEXIBLE_ARRAY_MEMBER];
      |                 ^~~~~~~~

Creating bug reports for each of the warnings found building from the
master branch on win32 as requested in this thread:
  https://lists.gnu.org/archive/html/emacs-devel/2022-04/msg00069.html

NOTE, the resulting Emacs does launch; I've used it to prepare this bug report.

In GNU Emacs 29.0.50 (build 1, x86_64-w64-mingw32)
 of 2022-04-02 built on AVALON
Repository revision: be21c95842f37e164606a6b392f5396d91506f61
Repository branch: master
Windowing system distributor 'Microsoft Corp.', version 10.0.19043
System Description: Microsoft Windows 10 Home (v10.0.2009.19043.1620)

Configured using:
 'configure --without-dbus --with-native-compilation
 --without-compress-install -C 'CFLAGS=-O2 -g3''

Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS WEBP XPM ZLIB

Important settings:
  value of $LANG: ENU
  locale-coding-system: cp1252

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media rmc puny
dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg
rfc6068 epg-config gnus-util text-property-search time-date mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils comp
comp-cstr warnings rx cl-seq cl-macs cl-extra help-mode seq gv subr-x
byte-opt cl-loaddefs cl-lib bytecomp byte-compile cconv iso-transl
tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel dos-w32 ls-lisp disp-table
term/w32-win w32-win w32-vars term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice simple cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop
case-table epa-hook jka-cmpr-hook help abbrev obarray cl-preloaded
button loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads w32notify w32 lcms2 multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 97418 4795)
 (symbols 48 7260 1)
 (strings 32 27729 2155)
 (string-bytes 1 908575)
 (vectors 16 21660)
 (vector-slots 8 370022 32300)
 (floats 8 41 312)
 (intervals 56 237 0)
 (buffers 992 11))