public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r11-10776] libstdc++: Fix pool resource build errors for H8 [PR107801]
Date: Tue, 16 May 2023 12:50:46 +0000 (GMT)	[thread overview]
Message-ID: <20230516125046.D88E23836F30@sourceware.org> (raw)

https://gcc.gnu.org/g:047c0fae82ca1458339e7e9724d125d30b685898

commit r11-10776-g047c0fae82ca1458339e7e9724d125d30b685898
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Nov 22 09:53:36 2022 +0000

    libstdc++: Fix pool resource build errors for H8 [PR107801]
    
    The array of pool sizes was previously adjusted to work for msp430-elf
    which has 16-bit int and either 16-bit size_t or 20-bit size_t. The
    largest pool sizes were disabled unless size_t has more than 20 bits.
    
    The H8 family has 16-bit int but 32-bit size_t, which means that the
    largest sizes are enabled, but 1<<15 produces a negative number that
    then cannot be narrowed to size_t.
    
    Replace the test for 32-bit size_t with a test for 32-bit int, which
    means we won't use the 4kiB to 4MiB pools for targets with 16-bit int
    even if they have a wider size_t.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/107801
            * src/c++17/memory_resource.cc (pool_sizes): Disable large pools
            for targets with 16-bit int.
    
    (cherry picked from commit 0f9659e770304d3c44cfa0e793833a461bc487aa)

Diff:
---
 libstdc++-v3/src/c++17/memory_resource.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/src/c++17/memory_resource.cc b/libstdc++-v3/src/c++17/memory_resource.cc
index 5dfc29fc0ec..154e334ba14 100644
--- a/libstdc++-v3/src/c++17/memory_resource.cc
+++ b/libstdc++-v3/src/c++17/memory_resource.cc
@@ -870,9 +870,11 @@ namespace pmr
       256, 320, 384, 448,
       512, 768,
 #if __SIZE_WIDTH__ > 16
+      // Use bigger pools if size_t has at least 20 bits.
       1024, 1536,
       2048, 3072,
-#if __SIZE_WIDTH__ > 20
+#if __INT_WIDTH__ >= 32
+      // Use even bigger pools if int has at least 32 bits.
       1<<12, 1<<13, 1<<14,
       1<<15, 1<<16, 1<<17,
       1<<20, 1<<21, 1<<22 // 4MB should be enough for anybody

                 reply	other threads:[~2023-05-16 12:50 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=20230516125046.D88E23836F30@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.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).