From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 928EC3858C66; Tue, 22 Nov 2022 11:06:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 928EC3858C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669115171; bh=Xa15SgQU8RIn9HiLvTmRDU8v6YhzefyBOiz6L/ER6F4=; h=From:To:Subject:Date:From; b=mMiqeKDIdfGJLFsWvz0MDlSWWkwjY06PNBZxohJcfCABl9jPuyeBS3bvNGrJpAykc SNlGOfNvNqiz5PzwkPT3iHOFdpzh0fJt317vrUS+qfr6i+V+MLQGrHJqs+3xpFHi+O 45E0kGtS/28y9byMSX1/yfc0BjfK4KoA4IqjNiQM= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-8926] libstdc++: Fix pool resource build errors for H8 [PR107801] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-12 X-Git-Oldrev: 4bd202226b1d1464d264ce578ec71710dcae0058 X-Git-Newrev: 691012693aaa831e4cd1ab5180195792e32baceb Message-Id: <20221122110611.928EC3858C66@sourceware.org> Date: Tue, 22 Nov 2022 11:06:11 +0000 (GMT) List-Id: https://gcc.gnu.org/g:691012693aaa831e4cd1ab5180195792e32baceb commit r12-8926-g691012693aaa831e4cd1ab5180195792e32baceb Author: Jonathan Wakely 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 bb6334c9694..d6555aa8823 100644 --- a/libstdc++-v3/src/c++17/memory_resource.cc +++ b/libstdc++-v3/src/c++17/memory_resource.cc @@ -874,9 +874,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