From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?=C3=93scar_Fuentes?= Newsgroups: gmane.emacs.devel Subject: Re: Warnings in mingw64 build on emacs-28 branch Date: Sun, 07 Nov 2021 20:25:21 +0100 Message-ID: <87ilx3g44e.fsf@telefonica.net> References: <86y260c9b8.fsf@gmail.com> <83fss880qc.fsf@gnu.org> <87r1bsezfn.fsf@telefonica.net> <8335o795e6.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18062"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) To: emacs-devel@gnu.org Cancel-Lock: sha1:wjAc3S59NNjg1vIRCc5PR90s8S8= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 07 20:26:45 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 1mjnoT-0004TR-DE for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Nov 2021 20:26:45 +0100 Original-Received: from [::1] (port=42292 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mjnoR-0006cG-68 for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Nov 2021 14:26:43 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50732) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mjnnP-0005vg-8d for emacs-devel@gnu.org; Sun, 07 Nov 2021 14:25:39 -0500 Original-Received: from ciao.gmane.io ([116.202.254.214]:58962) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mjnnJ-00054X-Dm for emacs-devel@gnu.org; Sun, 07 Nov 2021 14:25:38 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1mjnnG-00035F-7Z for emacs-devel@gnu.org; Sun, 07 Nov 2021 20:25:30 +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: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.248, 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:278975 Archived-At: Eli Zaretskii writes: >> From: Óscar Fuentes >> Date: Sun, 07 Nov 2021 16:51:56 +0100 >> >> AFAIU that call to VirtualQuery does not do what we want. When lpAddress >> is provided the function rounds down the address to a page boundary and >> starts scanning pages *up*. Since we want information about the capacity >> of the stack, the scan ignores all the space below the current page >> boundary. > > How do you see that it _ignores_ that space? The code does this: > > rlp->rlim_cur = (DWORD_PTR) &m - (DWORD_PTR) m.AllocationBase; > > m.AllocationBase is not the page of 'm', it's the base address of a > range of pages to which 'm' belongs. And since Emacs calls getrlimit > very early during its startup, directly from 'main', 'm' is not far > from the beginning of the stack, and m.AllocationBase is very likely > to be the base address of the memory initially allocated for the > stack. > > It is a matter of fact that the result of this code produces the 8MB > stack size that Emacs on Windows is compiled to use (see the link > command in src/Makefile.in). So it isn't just the theory, that code > actually works. > > So I think we are okay in that department. Yes, I concentrated on the description of VirtualQuery, which looks like it ignores everything below lpAddress, and didn't pay attention to MEMORY_BASIC_INFORMATION contents. Sorry for the noise. As for the warning, I think it is because a const void* is passed to VirtualQuery pointing to an uninitialized object.