https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107883
Bug ID: 107883 Summary: c++17/memory_resource.cc build error for H8/300 target Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: uaa at mx5 dot nisiq.net Target Milestone: --- Created attachment 53972 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53972&action=edit error log of memory_resource.cc On building gcc-12.2.0 with newlib-4.1.0 (newlib and libgloss) and binutils-2.36.1 on Debian-11.5/amd64. gcc/config/h8300/t-h8300 is modified with: MULTILIB_OPTIONS = ms/msx mint32 MULTILIB_DIRNAMES = h8300s h8sx int32 to disable building H8 normal mode library. gcc configuration is: ../configure --target=h8300-unknown-elf --enable-languages=c,c++ \ --prefix=/home/uaa/h8300 --with-newlib --disable-nls --disable-libssp \ --disable-libgomp --disable-libstdcxx-pch \ --disable-libstdcxx-filesystem-ts --with-newlib --disable-wchar_t error occurs at libstdc++-v3/src/c++17/memory_resource.cc, due to the size of int is 16bit (H8/300 default). log is at attachment. Here is the remedy: --- memory_resource.cc~ 2022-08-19 17:09:55.532700260 +0900 +++ memory_resource.cc 2022-11-27 06:35:31.076329143 +0900 @@ -877,9 +877,9 @@ namespace pmr 1024, 1536, 2048, 3072, #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 + (size_t)1<<12, (size_t)1<<13, (size_t)1<<14, + (size_t)1<<15, (size_t)1<<16, (size_t)1<<17, + (size_t)1<<20, (size_t)1<<21, (size_t)1<<22 // 4MB should be enough for anybody #endif #endif };