From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andy Moreton Newsgroups: gmane.emacs.devel Subject: Re: Warnings in mingw64 build on emacs-28 branch Date: Sun, 07 Nov 2021 18:07:11 +0000 Message-ID: <86zgqflu0g.fsf@gmail.com> References: <86y260c9b8.fsf@gmail.com> <83fss880qc.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12531"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (windows-nt) To: emacs-devel@gnu.org Cancel-Lock: sha1:xUvgSSeGe35bRU0QtVhOPh42FAE= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 07 19:07:57 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mjmaD-00033p-FF for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Nov 2021 19:07:57 +0100 Original-Received: from [::1] (port=44480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mjmaC-00024M-5Z for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Nov 2021 13:07:56 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mjmZf-0001OB-Pl for emacs-devel@gnu.org; Sun, 07 Nov 2021 13:07:23 -0500 Original-Received: from ciao.gmane.io ([116.202.254.214]:57044) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mjmZe-0001e6-3Y for emacs-devel@gnu.org; Sun, 07 Nov 2021 13:07:23 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1mjmZZ-0002HL-OG for emacs-devel@gnu.org; Sun, 07 Nov 2021 19:07:17 +0100 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:278971 Archived-At: On Sun 07 Nov 2021, Eli Zaretskii wrote: >> From: Andy Moreton >> Date: Sun, 07 Nov 2021 14:46:51 +0000 >> >> 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. > > I hope I fixed this now. Yes, thanks. >> 2) This warning has been present for a long time, and seems to be >> confusion over the flexible array handling. > > I'm not sure what this is about. We use memcpy to copy from a Lisp > vector's contents in gazillion other places, and I understand they > don't cause any warnings? How is this place different? No idea. I think this may have been discussed previously, but I cannot find it in the mail archives. xvector_contents_addr in lisp.h mentions gcc bug 95072 (filed by Paul Eggert with a similar code example). Should this be using xvector_contents or vcopy to placate this warning ? >> 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; >> | ^ > > That's a compiler bug, I think. I see nothing wrong in the call. Indeed, although passing "&m" as PMEMORY_BASIC_INFORMATION and as LPCVOID introduces aliasing. AndyM