[Top][All Lists]

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

Re: Warnings in mingw64 build on emacs-28 branch

From: Óscar Fuentes
Subject: Re: Warnings in mingw64 build on emacs-28 branch
Date: Sun, 07 Nov 2021 20:25:21 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Óscar Fuentes <ofv@wanadoo.es>
>> 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

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.

reply via email to

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