public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: workaround a g++ 11.2 initialization bug
Date: Thu, 26 Aug 2021 20:22:12 +0000 (GMT) [thread overview]
Message-ID: <20210826202212.09DD93858402@sourceware.org> (raw)
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=bdb7991db38b7bc802f4ef498a16ee850a837f44
commit bdb7991db38b7bc802f4ef498a16ee850a837f44
Author: Corinna Vinschen <corinna@vinschen.de>
Date: Thu Aug 26 22:19:20 2021 +0200
Cygwin: workaround a g++ 11.2 initialization bug
trying to use aggregate initialization syntax on a member of a
nameless union member failes in g++ 11.2.
Workaround this by using explicit initialization.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diff:
---
winsup/cygwin/miscfuncs.cc | 22 ++++++++++++----------
winsup/cygwin/mmap.cc | 20 ++++++++++----------
2 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc
index cba2140b6..f4c3a1c48 100644
--- a/winsup/cygwin/miscfuncs.cc
+++ b/winsup/cygwin/miscfuncs.cc
@@ -511,15 +511,16 @@ class thread_allocator
PVOID (thread_allocator::*alloc_func) (SIZE_T);
PVOID _alloc (SIZE_T size)
{
- MEM_ADDRESS_REQUIREMENTS thread_req = {
+ static const MEM_ADDRESS_REQUIREMENTS thread_req = {
(PVOID) THREAD_STORAGE_LOW,
(PVOID) (THREAD_STORAGE_HIGH - 1),
THREAD_STACK_SLOT
};
- MEM_EXTENDED_PARAMETER thread_ext = {
- .Type = MemExtendedParameterAddressRequirements,
- .Pointer = (PVOID) &thread_req
- };
+ /* g++ 11.2 workaround: don't use initializer */
+ MEM_EXTENDED_PARAMETER thread_ext;
+ thread_ext.Type = MemExtendedParameterAddressRequirements;
+ thread_ext.Pointer = (PVOID) &thread_req;
+
SIZE_T real_size = roundup2 (size, THREAD_STACK_SLOT);
PVOID real_stackaddr = NULL;
@@ -531,15 +532,16 @@ class thread_allocator
monster stack, fulfill request from mmap area. */
if (!real_stackaddr)
{
- MEM_ADDRESS_REQUIREMENTS mmap_req = {
+ static const MEM_ADDRESS_REQUIREMENTS mmap_req = {
(PVOID) MMAP_STORAGE_LOW,
(PVOID) (MMAP_STORAGE_HIGH - 1),
THREAD_STACK_SLOT
};
- MEM_EXTENDED_PARAMETER mmap_ext = {
- .Type = MemExtendedParameterAddressRequirements,
- .Pointer = (PVOID) &mmap_req
- };
+ /* g++ 11.2 workaround: don't use initializer */
+ MEM_EXTENDED_PARAMETER mmap_ext;
+ mmap_ext.Type = MemExtendedParameterAddressRequirements;
+ mmap_ext.Pointer = (PVOID) &mmap_req;
+
real_stackaddr = VirtualAlloc2 (GetCurrentProcess(), NULL, real_size,
MEM_RESERVE | MEM_TOP_DOWN,
PAGE_READWRITE, &mmap_ext, 1);
diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc
index 6b2e1c655..69c8c8990 100644
--- a/winsup/cygwin/mmap.cc
+++ b/winsup/cygwin/mmap.cc
@@ -201,15 +201,15 @@ MapView (HANDLE h, void *addr, size_t len, DWORD openflags,
a function under loader lock (STATUS_DLL_INIT_FAILED). */
if (!from_fixup_after_fork && wincap.has_extended_mem_api ())
{
- MEM_ADDRESS_REQUIREMENTS mmap_req = {
+ static const MEM_ADDRESS_REQUIREMENTS mmap_req = {
(PVOID) MMAP_STORAGE_LOW,
(PVOID) (MMAP_STORAGE_HIGH - 1),
0
};
- MEM_EXTENDED_PARAMETER mmap_ext = {
- .Type = MemExtendedParameterAddressRequirements,
- .Pointer = (PVOID) &mmap_req
- };
+ /* g++ 11.2 workaround: don't use initializer */
+ MEM_EXTENDED_PARAMETER mmap_ext;
+ mmap_ext.Type = MemExtendedParameterAddressRequirements;
+ mmap_ext.Pointer = (PVOID) &mmap_req;
alloc_type |= attached (prot) ? MEM_RESERVE : 0;
status = NtMapViewOfSectionEx (h, NtCurrentProcess (), &base, &offset,
@@ -1621,15 +1621,15 @@ fhandler_dev_zero::mmap (caddr_t *addr, size_t len, int prot,
#ifdef __x86_64__
if (wincap.has_extended_mem_api ())
{
- MEM_ADDRESS_REQUIREMENTS mmap_req = {
+ static const MEM_ADDRESS_REQUIREMENTS mmap_req = {
(PVOID) MMAP_STORAGE_LOW,
(PVOID) (MMAP_STORAGE_HIGH - 1),
0
};
- MEM_EXTENDED_PARAMETER mmap_ext = {
- .Type = MemExtendedParameterAddressRequirements,
- .Pointer = (PVOID) &mmap_req
- };
+ /* g++ 11.2 workaround: don't use initializer */
+ MEM_EXTENDED_PARAMETER mmap_ext;
+ mmap_ext.Type = MemExtendedParameterAddressRequirements;
+ mmap_ext.Pointer = (PVOID) &mmap_req;
base = VirtualAlloc2 (GetCurrentProcess(), *addr, len, alloc_type,
protect, *addr ? NULL : &mmap_ext,
reply other threads:[~2021-08-26 20:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210826202212.09DD93858402@sourceware.org \
--to=corinna@sourceware.org \
--cc=cygwin-cvs@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).