[Bug libstdc++/88111] libstdc++-v3 FTB for 16-bit int: memory_resource.cc pool_sizes expects >16-bit int/size_t
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Nov 21 13:43:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88111
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Does it even make sense to have pools for objects of 1024 bytes on a 16-bit
target? Is anybody really going to dynamically-allocate lots of 1kb objects?
It certainly seems unnecessary to support objects of size 1<<14 bytes.
I'd prefer to fix this for any 16-bit targets, not just msp430, so I don't want
the fix to check __MSP430X_LARGE__.
So taking all the above into account, and assuming __SIZE_WIDTH__ is set
correctly, something like this seems preferable:
--- a/libstdc++-v3/src/c++17/memory_resource.cc
+++ b/libstdc++-v3/src/c++17/memory_resource.cc
@@ -820,10 +820,15 @@ namespace pmr
128, 192,
256, 320, 384, 448,
512, 768,
+#if __SIZE_WIDTH__ > 16
1024, 1536,
2048, 3072,
- 1<<12, 1<<13, 1<<14, 1<<15, 1<<16, 1<<17,
+#if __SIZE_WIDTH__ > 20
+ 1<<12, 1<<13, 1<<14,
+ 1<<15, 1<<16, 1<<17,
1<<20, 1<<21, 1<<22 // 4MB should be enough for anybody
+#endif
+#endif
};
pool_options
More information about the Gcc-bugs
mailing list