public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
@ 2022-11-22  4:56 jdx at o2 dot pl
  2022-11-22  9:08 ` [Bug libstdc++/107801] " redi at gcc dot gnu.org
                   ` (21 more replies)
  0 siblings, 22 replies; 23+ messages in thread
From: jdx at o2 dot pl @ 2022-11-22  4:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

            Bug ID: 107801
           Summary: Building cross compiler for H8 family fails in
                    libstdc++ (c++17/memory_resource.cc)
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jdx at o2 dot pl
  Target Milestone: ---

I am trying to build under MingW64/Windows 10 the toolchain for H8 using
following steps:
1. build binutils and install it to a sysroot,
2. build "stage 1" gcc and install it to the sysroot,
3. build newlib and install it to the sysroot,
4. build "stage 2" gcc and install it to the sysroot,
5. build gdb.

"Stage 1" configuration command:
../gcc-12.2.0/configure --prefix=/usr/local
--with-sysroot=/d/Works/xcomp/sysroot --target=h8300-elf --disable-nls
--disable-threads --disable-tls --enable-checking=release --enable-languages=c
--with-newlib --without-headers --enable-multilib --enable-lto --disable-shared
--enable-static --disable-host-shared --disable-bootstrap --disable-libatomic
--disable-libgomp --disable-libitm --disable-libquadmath --disable-libsanitizer
--disable-libssp --disable-libvtv --with-system-zlib --with-pkgversion='GNU
Toolchain for the Renesas H8\, H8S and H8SX Families [Built by jdx]'

"Stage 2" configuration command:
CFLAGS_FOR_TARGET+="-isystem /d/Works/xcomp/sysroot/h8300-elf/include"
CXXFLAGS_FOR_TARGET+="-isystem /d/Works/xcomp/sysroot/h8300-elf/include"
../gcc-12.2.0/configure --prefix=/usr/local
--with-sysroot=/d/Works/xcomp/sysroot --target=h8300-elf --disable-nls
--disable-threads --disable-tls --enable-checking=release
--enable-languages=c,c++ --with-newlib --enable-multilib --enable-lto
--disable-shared --enable-static --disable-host-shared --disable-libstdcxx-pch
--with-system-zlib --with-pkgversion='GNU Toolchain for the Renesas H8\, H8S
and H8SX Families [Built by jdx]'

The building process fails when building "stage 2" gcc with following error
message:
[...]
Making all in c++17
make[5]: Entering directory
'/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src/c++17'
/bin/sh ../../libtool --tag CXX --tag disable-shared   --mode=compile
/d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include   
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++   -std=gnu++17 -nostdinc++  
-fno-implicit-templates  -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2 
-fdiagnostics-show-location=once   -ffunction-sections -fdata-sections 
-frandom-seed=floating_from_chars.lo  -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include  -c -o floating_from_chars.lo
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/floating_from_chars.cc
libtool: compile:  /d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++ -std=gnu++17 -nostdinc++
-fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2
-fdiagnostics-show-location=once -ffunction-sections -fdata-sections
-frandom-seed=floating_from_chars.lo -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include -c
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/floating_from_chars.cc -o
floating_from_chars.o
/bin/sh ../../libtool --tag CXX --tag disable-shared   --mode=compile
/d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include   
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++   -std=gnu++17 -nostdinc++  
-fno-implicit-templates  -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2 
-fdiagnostics-show-location=once   -ffunction-sections -fdata-sections 
-frandom-seed=floating_to_chars.lo  -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include  -c -o floating_to_chars.lo
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/floating_to_chars.cc
libtool: compile:  /d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++ -std=gnu++17 -nostdinc++
-fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2
-fdiagnostics-show-location=once -ffunction-sections -fdata-sections
-frandom-seed=floating_to_chars.lo -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include -c
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/floating_to_chars.cc -o
floating_to_chars.o
/bin/sh ../../libtool --tag CXX --tag disable-shared   --mode=compile
/d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include   
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++   -std=gnu++17 -nostdinc++  
-fno-implicit-templates  -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2 
-fdiagnostics-show-location=once   -ffunction-sections -fdata-sections 
-frandom-seed=fs_dir.lo  -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include  -c -o fs_dir.lo
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/fs_dir.cc
libtool: compile:  /d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++ -std=gnu++17 -nostdinc++
-fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2
-fdiagnostics-show-location=once -ffunction-sections -fdata-sections
-frandom-seed=fs_dir.lo -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include -c
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/fs_dir.cc -o fs_dir.o
In file included from
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/fs_dir.cc:37:
d:\works\xcomp\gcc-12.2.0\libstdc++-v3\src\filesystem\dir-common.h: In static
member function 'static std::filesystem::__gnu_posix::DIR*
std::filesystem::_Dir_base::openat(const _At_path&, bool)':
d:\works\xcomp\gcc-12.2.0\libstdc++-v3\src\filesystem\dir-common.h:210:36:
warning: unused parameter 'nofollow' [-Wunused-parameter]
  210 |   openat(const _At_path& atp, bool nofollow)
      |                               ~~~~~^~~~~~~~
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/fs_dir.cc: In member function
'bool std::filesystem::__cxx11::_Dir::do_unlink(bool, std::error_code&) const':
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/fs_dir.cc:147:18: warning:
unused parameter 'is_directory' [-Wunused-parameter]
  147 |   do_unlink(bool is_directory, error_code& ec) const noexcept
      |             ~~~~~^~~~~~~~~~~~
/bin/sh ../../libtool --tag CXX --tag disable-shared   --mode=compile
/d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include   
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++   -std=gnu++17 -nostdinc++  
-fno-implicit-templates  -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2 
-fdiagnostics-show-location=once   -ffunction-sections -fdata-sections 
-frandom-seed=fs_ops.lo  -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include  -c -o fs_ops.lo
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/fs_ops.cc
libtool: compile:  /d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++ -std=gnu++17 -nostdinc++
-fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2
-fdiagnostics-show-location=once -ffunction-sections -fdata-sections
-frandom-seed=fs_ops.lo -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include -c
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/fs_ops.cc -o fs_ops.o
/bin/sh ../../libtool --tag CXX --tag disable-shared   --mode=compile
/d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include   
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++   -std=gnu++17 -nostdinc++  
-fno-implicit-templates  -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2 
-fdiagnostics-show-location=once   -ffunction-sections -fdata-sections 
-frandom-seed=fs_path.lo  -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include  -c -o fs_path.lo
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/fs_path.cc
libtool: compile:  /d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++ -std=gnu++17 -nostdinc++
-fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2
-fdiagnostics-show-location=once -ffunction-sections -fdata-sections
-frandom-seed=fs_path.lo -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include -c
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/fs_path.cc -o fs_path.o
/bin/sh ../../libtool --tag CXX --tag disable-shared   --mode=compile
/d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include   
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++   -std=gnu++17 -nostdinc++  
-fno-implicit-templates  -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2 
-fdiagnostics-show-location=once   -ffunction-sections -fdata-sections 
-frandom-seed=memory_resource.lo  -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include  -c -o memory_resource.lo
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/memory_resource.cc
libtool: compile:  /d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++ -std=gnu++17 -nostdinc++
-fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2
-fdiagnostics-show-location=once -ffunction-sections -fdata-sections
-frandom-seed=memory_resource.lo -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include -c
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/memory_resource.cc -o
memory_resource.o
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/memory_resource.cc:881:15:
warning: left shift count >= width of type [-Wshift-count-overflow]
  881 |       1<<15, 1<<16, 1<<17,
      |              ~^~~~
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/memory_resource.cc:881:22:
warning: left shift count >= width of type [-Wshift-count-overflow]
  881 |       1<<15, 1<<16, 1<<17,
      |                     ~^~~~
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/memory_resource.cc:882:8:
warning: left shift count >= width of type [-Wshift-count-overflow]
  882 |       1<<20, 1<<21, 1<<22 // 4MB should be enough for anybody
      |       ~^~~~
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/memory_resource.cc:882:15:
warning: left shift count >= width of type [-Wshift-count-overflow]
  882 |       1<<20, 1<<21, 1<<22 // 4MB should be enough for anybody
      |              ~^~~~
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/memory_resource.cc:882:22:
warning: left shift count >= width of type [-Wshift-count-overflow]
  882 |       1<<20, 1<<21, 1<<22 // 4MB should be enough for anybody
      |                     ~^~~~
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/memory_resource.cc:881:8:
error: narrowing conversion of '-32768' from 'int' to 'std::size_t' {aka 'long
unsigned int'} [-Wnarrowing]
  881 |       1<<15, 1<<16, 1<<17,
      |       ~^~~~
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/memory_resource.cc: In
function 'std::pmr::pool_options
std::pmr::{anonymous}::munge_options(std::pmr::pool_options)':
../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/memory_resource.cc:937:44:
error: non-constant condition for static assertion
  937 |         static_assert(std::__has_single_bit(pool_sizes[0]));
      |                       ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
make[5]: *** [Makefile:585: memory_resource.lo] Error 1
make[5]: Leaving directory
'/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src/c++17'
make[4]: *** [Makefile:781: all-recursive] Error 1
make[4]: Leaving directory
'/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3/src'
make[3]: *** [Makefile:576: all-recursive] Error 1
make[3]: Leaving directory '/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3'
make[2]: *** [Makefile:501: all] Error 2
make[2]: Leaving directory '/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3'
make[1]: *** [Makefile:12297: all-target-libstdc++-v3] Error 2
make[1]: Leaving directory '/d/Works/xcomp/gcc-build'
make: *** [Makefile:1043: all] Error 2

This is likely due to the fact that on H8/300H, H8S and H8SX int is 16 bits
wide by default (i.e. unless -mint32 is passed to the compiler, see
https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/H8_002f300-Options.html); on
H8/300 int is always 16 bit wide.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
  2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
@ 2022-11-22  9:08 ` redi at gcc dot gnu.org
  2022-11-22  9:10 ` redi at gcc dot gnu.org
                   ` (20 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-22  9:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-11-22

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Looks like your size_t is 32 bits though, which is why that code doesn't work.
On msp430-elf size_t is width 20, so those constants are not used.

This should fix it:

--- a/libstdc++-v3/src/c++17/memory_resource.cc
+++ b/libstdc++-v3/src/c++17/memory_resource.cc
@@ -876,9 +876,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
+      1lu<<12, 1lu<<13, 1lu<<14,
+      1lu<<15, 1lu<<16, 1lu<<17,
+      1lu<<20, 1lu<<21, 1lu<<22 // 4MB should be enough for anybody
 #endif
 #endif
   };

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
  2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
  2022-11-22  9:08 ` [Bug libstdc++/107801] " redi at gcc dot gnu.org
@ 2022-11-22  9:10 ` redi at gcc dot gnu.org
  2022-11-22  9:20 ` redi at gcc dot gnu.org
                   ` (19 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-22  9:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.4
           Keywords|                            |build
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=88113,
                   |                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=88111

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
  2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
  2022-11-22  9:08 ` [Bug libstdc++/107801] " redi at gcc dot gnu.org
  2022-11-22  9:10 ` redi at gcc dot gnu.org
@ 2022-11-22  9:20 ` redi at gcc dot gnu.org
  2022-11-22 10:39 ` cvs-commit at gcc dot gnu.org
                   ` (18 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-22  9:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
But you probably don't want those huge pools if you only have 16-bit int, so
checking __SIZE_WIDTH__ isn't enough here.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
  2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
                   ` (2 preceding siblings ...)
  2022-11-22  9:20 ` redi at gcc dot gnu.org
@ 2022-11-22 10:39 ` cvs-commit at gcc dot gnu.org
  2022-11-22 11:06 ` cvs-commit at gcc dot gnu.org
                   ` (17 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-22 10:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:0f9659e770304d3c44cfa0e793833a461bc487aa

commit r13-4228-g0f9659e770304d3c44cfa0e793833a461bc487aa
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.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
  2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
                   ` (3 preceding siblings ...)
  2022-11-22 10:39 ` cvs-commit at gcc dot gnu.org
@ 2022-11-22 11:06 ` cvs-commit at gcc dot gnu.org
  2022-11-22 17:05 ` jdx at o2 dot pl
                   ` (16 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-22 11:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:691012693aaa831e4cd1ab5180195792e32baceb

commit r12-8926-g691012693aaa831e4cd1ab5180195792e32baceb
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)

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
  2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
                   ` (4 preceding siblings ...)
  2022-11-22 11:06 ` cvs-commit at gcc dot gnu.org
@ 2022-11-22 17:05 ` jdx at o2 dot pl
  2022-11-22 17:09 ` redi at gcc dot gnu.org
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jdx at o2 dot pl @ 2022-11-22 17:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

--- Comment #5 from jdx at o2 dot pl ---
(In reply to CVS Commits from comment #4)
> The releases/gcc-12 branch has been updated by Jonathan Wakely
> <redi@gcc.gnu.org>:
> 
> https://gcc.gnu.org/g:691012693aaa831e4cd1ab5180195792e32baceb
> 
> commit r12-8926-g691012693aaa831e4cd1ab5180195792e32baceb
> 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.

Jonathan,
a bit of explanation regarding H8 family – it has a few "subfamilies":

1. H8/300 and H8/300L (L from "low power" AFAIR) – these are pure 16-bit MCUs,
it has 16-bit general purpose registers, sizeof(int) = sizeof(size_t) = 2;
AFAIK they are not manufactured anymore; I have never used any of them.

2. H8/300H, H8S and H8SX – Renesas/Hitachi calls them 16-bit but I call them
quasi 32-bit MCUs because they have 32-bit GPRs and instructions, although data
bus width is 16 bit. Here things are more complicated – sizeof(size_t) = 4 but
sizeof(int) may be  2 or 4 depending on -mint32 command line option. To get
things even more complicated, these MCUs have also so called "normal mode" (-mn
option) – it is compatibility mode with H8/300 and obviously in this mode
sizeof(int) = sizeof(size_t) = 2; __NORMAL_MODE__ macro is defined in this
mode.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
  2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
                   ` (5 preceding siblings ...)
  2022-11-22 17:05 ` jdx at o2 dot pl
@ 2022-11-22 17:09 ` redi at gcc dot gnu.org
  2022-11-23  5:16 ` jdx at o2 dot pl
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-22 17:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Understood, thanks. My commit message could have been worded more precisely,
but none of that matters for the purposes of the fix. What matters is that
there is at least one target with 16-bit int and 32-bit size_t, and after the
commits above, that should be supported.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
  2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
                   ` (6 preceding siblings ...)
  2022-11-22 17:09 ` redi at gcc dot gnu.org
@ 2022-11-23  5:16 ` jdx at o2 dot pl
  2022-11-26 21:41 ` pinskia at gcc dot gnu.org
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jdx at o2 dot pl @ 2022-11-23  5:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

--- Comment #7 from Jan Dubiec <jdx at o2 dot pl> ---
OK, I have applied the patch manually to my 12.2.0 tree and libstdc++ has been
partially build. "Partially" because everything seems to be fine for H8/300H,
H8S and H8SX in "advanced mode" (let's call it "32-bit mode") but compilation
fails (in the same file!) in "normal mode" ("16-bit mode"). Note the -mn
option:

[...]
Making all in c++17
make[9]: Entering directory
'/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src/c++17'
/bin/sh ../../libtool --tag CXX --tag disable-shared   --mode=compile
/d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include  -mn
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++   -std=gnu++17 -nostdinc++  
-fno-implicit-templates  -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2 
-fdiagnostics-show-location=once   -ffunction-sections -fdata-sections 
-frandom-seed=floating_from_chars.lo  -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include  -mn  -c -o floating_from_chars.lo
../../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/floating_from_chars.cc
libtool: compile:  /d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include -mn
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++ -std=gnu++17 -nostdinc++
-fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2
-fdiagnostics-show-location=once -ffunction-sections -fdata-sections
-frandom-seed=floating_from_chars.lo -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include -mn -c
../../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/floating_from_chars.cc -o
floating_from_chars.o
/bin/sh ../../libtool --tag CXX --tag disable-shared   --mode=compile
/d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include  -mn
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++   -std=gnu++17 -nostdinc++  
-fno-implicit-templates  -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2 
-fdiagnostics-show-location=once   -ffunction-sections -fdata-sections 
-frandom-seed=floating_to_chars.lo  -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include  -mn  -c -o floating_to_chars.lo
../../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/floating_to_chars.cc
libtool: compile:  /d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include -mn
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++ -std=gnu++17 -nostdinc++
-fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2
-fdiagnostics-show-location=once -ffunction-sections -fdata-sections
-frandom-seed=floating_to_chars.lo -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include -mn -c
../../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/floating_to_chars.cc -o
floating_to_chars.o
/bin/sh ../../libtool --tag CXX --tag disable-shared   --mode=compile
/d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include  -mn
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++   -std=gnu++17 -nostdinc++  
-fno-implicit-templates  -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2 
-fdiagnostics-show-location=once   -ffunction-sections -fdata-sections 
-frandom-seed=fs_dir.lo  -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include  -mn  -c -o fs_dir.lo
../../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/fs_dir.cc
libtool: compile:  /d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include -mn
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++ -std=gnu++17 -nostdinc++
-fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2
-fdiagnostics-show-location=once -ffunction-sections -fdata-sections
-frandom-seed=fs_dir.lo -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include -mn -c
../../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/fs_dir.cc -o fs_dir.o
In file included from
d:\works\xcomp\gcc-12.2.0\libstdc++-v3\src\c++17\fs_dir.cc:37:
d:\works\xcomp\gcc-12.2.0\libstdc++-v3\src\filesystem\dir-common.h: In static
member function 'static std::filesystem::__gnu_posix::DIR*
std::filesystem::_Dir_base::openat(const _At_path&, bool)':
d:\works\xcomp\gcc-12.2.0\libstdc++-v3\src\filesystem\dir-common.h:210:36:
warning: unused parameter 'nofollow' [-Wunused-parameter]
  210 |   openat(const _At_path& atp, bool nofollow)
      |                               ~~~~~^~~~~~~~
d:\works\xcomp\gcc-12.2.0\libstdc++-v3\src\c++17\fs_dir.cc: In member function
'bool std::filesystem::__cxx11::_Dir::do_unlink(bool, std::error_code&) const':
d:\works\xcomp\gcc-12.2.0\libstdc++-v3\src\c++17\fs_dir.cc:147:18: warning:
unused parameter 'is_directory' [-Wunused-parameter]
  147 |   do_unlink(bool is_directory, error_code& ec) const noexcept
      |             ~~~~~^~~~~~~~~~~~
/bin/sh ../../libtool --tag CXX --tag disable-shared   --mode=compile
/d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include  -mn
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++   -std=gnu++17 -nostdinc++  
-fno-implicit-templates  -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2 
-fdiagnostics-show-location=once   -ffunction-sections -fdata-sections 
-frandom-seed=fs_ops.lo  -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include  -mn  -c -o fs_ops.lo
../../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/fs_ops.cc
libtool: compile:  /d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include -mn
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++ -std=gnu++17 -nostdinc++
-fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2
-fdiagnostics-show-location=once -ffunction-sections -fdata-sections
-frandom-seed=fs_ops.lo -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include -mn -c
../../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/fs_ops.cc -o fs_ops.o
/bin/sh ../../libtool --tag CXX --tag disable-shared   --mode=compile
/d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include  -mn
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++   -std=gnu++17 -nostdinc++  
-fno-implicit-templates  -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2 
-fdiagnostics-show-location=once   -ffunction-sections -fdata-sections 
-frandom-seed=fs_path.lo  -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include  -mn  -c -o fs_path.lo
../../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/fs_path.cc
libtool: compile:  /d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include -mn
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++ -std=gnu++17 -nostdinc++
-fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2
-fdiagnostics-show-location=once -ffunction-sections -fdata-sections
-frandom-seed=fs_path.lo -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include -mn -c
../../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/fs_path.cc -o fs_path.o
/bin/sh ../../libtool --tag CXX --tag disable-shared   --mode=compile
/d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include  -mn
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++   -std=gnu++17 -nostdinc++  
-fno-implicit-templates  -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2 
-fdiagnostics-show-location=once   -ffunction-sections -fdata-sections 
-frandom-seed=memory_resource.lo  -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include  -mn  -c -o memory_resource.lo
../../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/memory_resource.cc
libtool: compile:  /d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include -mn
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++ -std=gnu++17 -nostdinc++
-fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2
-fdiagnostics-show-location=once -ffunction-sections -fdata-sections
-frandom-seed=memory_resource.lo -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include -mn -c
../../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/memory_resource.cc -o
memory_resource.o
d:\works\xcomp\gcc-12.2.0\libstdc++-v3\src\c++17\memory_resource.cc:583:7:
error: static assertion failed
  582 |   static_assert(sizeof(chunk)
      |                 ~~~~~~~~~~~~~
  583 |       == sizeof(bitset::size_type) + sizeof(uint32_t) + 2 *
sizeof(void*));
      |      
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
d:\works\xcomp\gcc-12.2.0\libstdc++-v3\src\c++17\memory_resource.cc:583:7:
note: the comparison reduces to '(12 == 10)'
make[9]: *** [Makefile:585: memory_resource.lo] Error 1
make[9]: Leaving directory
'/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src/c++17'
make[8]: *** [Makefile:781: all-recursive] Error 1
make[8]: Leaving directory
'/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3/src'
make[7]: *** [Makefile:576: all-recursive] Error 1
make[7]: Leaving directory
'/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3'
make[6]: *** [Makefile:501: all] Error 2
make[6]: Leaving directory
'/d/Works/xcomp/gcc-build/h8300-elf/normal/libstdc++-v3'
make[5]: *** [Makefile:870: multi-do] Error 1
make[5]: Leaving directory '/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3'
make[4]: *** [Makefile:840: all-multi] Error 2
make[4]: Leaving directory '/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3'
make[3]: *** [Makefile:576: all-recursive] Error 1
make[3]: Leaving directory '/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3'
make[2]: *** [Makefile:501: all] Error 2
make[2]: Leaving directory '/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3'
make[1]: *** [Makefile:12297: all-target-libstdc++-v3] Error 2
make[1]: Leaving directory '/d/Works/xcomp/gcc-build'
make: *** [Makefile:1043: all] Error 2

BTW. I can see -mn option above but AFAIK it has to be used with -mh or -ms or
-msx. So how the build system passes one of these options to the cross
compiler?

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
  2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
                   ` (7 preceding siblings ...)
  2022-11-23  5:16 ` jdx at o2 dot pl
@ 2022-11-26 21:41 ` pinskia at gcc dot gnu.org
  2022-11-27  2:31 ` jdx at o2 dot pl
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-26 21:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |uaa at mx5 dot nisiq.net

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 107883 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
  2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
                   ` (8 preceding siblings ...)
  2022-11-26 21:41 ` pinskia at gcc dot gnu.org
@ 2022-11-27  2:31 ` jdx at o2 dot pl
  2022-11-27  7:35 ` redi at gcc dot gnu.org
                   ` (11 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jdx at o2 dot pl @ 2022-11-27  2:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

--- Comment #9 from Jan Dubiec <jdx at o2 dot pl> ---
I think I have found why the static assertion fails as mentioned in my previous
comment. Surprisingly, for H8/300H, H8/S and H8/SX in normal mode 32-bit
integers and floats are aligned on 4-byte boundaries.

Let's consider following structure:

struct foo
{
        uint32_t i;
        uint16_t j;
};

In advanced mode sizeof(struct foo) is 8. In normal mode, i.e. when the code is
compiled with -mn, the size is still 8 although one could expect it to be 6
(and that is why the assertion fails). In order to the size be 6 bytes,
-malign-300 must be used along with -mn.

So the natural solution seems to be adding -malign-300 to the compiler options
when libstdc++ is built in normal mode.

BTW. I do not even get why 4-byte boundaries are used at all. According to
H8/300H and H8/S software manuals (I didn't check H8/SX) "The CPU can access
word data and longword data in memory, but word or longword data must begin at
an even address." (longword is 32-bit word in Renesas' nomenclature). They do
not state that alignment must be 4 bytes for 32-bit integers and floats.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
  2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
                   ` (9 preceding siblings ...)
  2022-11-27  2:31 ` jdx at o2 dot pl
@ 2022-11-27  7:35 ` redi at gcc dot gnu.org
  2022-11-28 12:10 ` redi at gcc dot gnu.org
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-27  7:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Thanks, that's very helpful.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
  2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
                   ` (10 preceding siblings ...)
  2022-11-27  7:35 ` redi at gcc dot gnu.org
@ 2022-11-28 12:10 ` redi at gcc dot gnu.org
  2022-11-28 13:32 ` redi at gcc dot gnu.org
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-28 12:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I don't think we want to build (parts of) the library with non-default options
like that. It might affect the ABI of the library, and all users would have to
use the same options for their own code.

I think we can just use bitset::size_type for the _M_bytes member. We don't
need to use uint32_t there if size_t only has 16 bits. We can't allocate that
much memory anyway.

--- a/libstdc++-v3/src/c++17/memory_resource.cc
+++ b/libstdc++-v3/src/c++17/memory_resource.cc
@@ -505,7 +505,7 @@ namespace pmr
     }

     // Allocated size of chunk:
-    uint32_t _M_bytes = 0;
+    bitset::size_type _M_bytes = 0;
     // Start of allocated chunk:
     std::byte* _M_p = nullptr;

@@ -579,7 +579,7 @@ namespace pmr
   // For 16-bit pointers it's five pointers (10 bytes).
   // TODO pad 64-bit to 4*sizeof(void*) to avoid splitting across cache lines?
   static_assert(sizeof(chunk)
-      == sizeof(bitset::size_type) + sizeof(uint32_t) + 2 * sizeof(void*));
+      == 2 * sizeof(bitset::size_type) + 2 * sizeof(void*));

   // An oversized allocation that doesn't fit in a pool.
   struct big_block





With that change, I get failures for fs_dir.cc instead:

libtool: compile:  /home/jwakely/src/gcc/build-h8/./gcc/xgcc -shared-libgcc
-B/home/jwakely/src/gcc/build-h8/./gcc -nostdinc++
-L/home/jwakely/src/gcc/build-h8/h8300-elf/normal/libstdc++-v3/src
-L/home/jwakely/src/gcc/build-h8/h8300-elf/normal/libstdc++-v3/src/.libs
-L/home/jwakely/src/gcc/build-h8/h8300-elf/normal/libstdc++-v3/libsupc++/.libs
-nostdinc -B/home/jwakely/src/gcc/build-h8/h8300-elf/normal/newlib/ -isystem
/home/jwakely/src/gcc/build-h8/h8300-elf/normal/newlib/targ-include -isystem
/home/jwakely/src/gcc/gcc/newlib/libc/include
-B/home/jwakely/gcc/h8300-elf/h8300-elf/bin/
-B/home/jwakely/gcc/h8300-elf/h8300-elf/lib/ -isystem
/home/jwakely/gcc/h8300-elf/h8300-elf/include -isystem
/home/jwakely/gcc/h8300-elf/h8300-elf/sys-include -mn
-I/home/jwakely/src/gcc/gcc/libstdc++-v3/../libgcc
-I/home/jwakely/src/gcc/build-h8/h8300-elf/normal/libstdc++-v3/include/h8300-elf
-I/home/jwakely/src/gcc/build-h8/h8300-elf/normal/libstdc++-v3/include
-I/home/jwakely/src/gcc/gcc/libstdc++-v3/libsupc++ -std=gnu++17 -nostdinc++
-fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2
-fdiagnostics-show-location=once -ffunction-sections -fdata-sections
-frandom-seed=fs_dir.lo -fimplicit-templates -g -O2 -c
/home/jwakely/src/gcc/gcc/libstdc++-v3/src/c++17/fs_dir.cc -o fs_dir.o
In file included from
/home/jwakely/src/gcc/gcc/libstdc++-v3/src/c++17/fs_dir.cc:37:
/home/jwakely/src/gcc/gcc/libstdc++-v3/src/c++17/../filesystem/dir-common.h: In
static member function ‘static std::filesystem::__gnu_posix::DIR*
std::filesystem::_Dir_base::openat(const _At_path&, bool)’:
/home/jwakely/src/gcc/gcc/libstdc++-v3/src/c++17/../filesystem/dir-common.h:210:36:
warning: unused parameter ‘nofollow’ [-Wunused-parameter]
  210 |   openat(const _At_path& atp, bool nofollow)
      |                               ~~~~~^~~~~~~~
/home/jwakely/src/gcc/gcc/libstdc++-v3/src/c++17/fs_dir.cc: In member function
‘bool std::filesystem::__cxx11::_Dir::do_unlink(bool, std::error_code&) const’:
/home/jwakely/src/gcc/gcc/libstdc++-v3/src/c++17/fs_dir.cc:147:18: warning:
unused parameter ‘is_directory’ [-Wunused-parameter]
  147 |   do_unlink(bool is_directory, error_code& ec) const noexcept
      |             ~~~~~^~~~~~~~~~~~
/tmp/ccsGgjxM.s: Assembler messages:
/tmp/ccsGgjxM.s:14980: Error: value of 000169ff too large for field of 2 bytes
at 00000010
/tmp/ccsGgjxM.s:14990: Error: value of 00025a7b too large for field of 2 bytes
at 0000002a
/tmp/ccsGgjxM.s:15018: Error: value of 0002e814 too large for field of 2 bytes
at 00000065
/tmp/ccsGgjxM.s:15024: Error: value of 0002e805 too large for field of 2 bytes
at 00000073
/tmp/ccsGgjxM.s:15033: Error: value of 00030c1c too large for field of 2 bytes
at 00000083
(and hundreds more assembler errors like that)

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
  2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
                   ` (11 preceding siblings ...)
  2022-11-28 12:10 ` redi at gcc dot gnu.org
@ 2022-11-28 13:32 ` redi at gcc dot gnu.org
  2022-11-28 16:57 ` cvs-commit at gcc dot gnu.org
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-28 13:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #11)
> I think we can just use bitset::size_type for the _M_bytes member.

This compiles for all multilibs of x86_64, h8300-elf, and msp430-elf.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
  2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
                   ` (12 preceding siblings ...)
  2022-11-28 13:32 ` redi at gcc dot gnu.org
@ 2022-11-28 16:57 ` cvs-commit at gcc dot gnu.org
  2022-11-28 17:01 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-28 16:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:75e562d2c4303d3918be9d1563284b0c580c5e45

commit r13-4371-g75e562d2c4303d3918be9d1563284b0c580c5e45
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Nov 28 13:28:53 2022 +0000

    libstdc++: Fix src/c++17/memory_resource for H8 targets [PR107801]

    This fixes compilation failures for H8 multilibs. For the normal
    multilib (ILP16L32?), the chunk struct does not have the expected size,
    because uint32_t is type long and has alignment 4 (by default). This
    forces sizeof(chunk) to be 12 instead of the expected 10. We can fix
    that by using bitset::size_type instead of uint32_t, so that we only use
    a 16-bit size when size_t and pointers are 16-bit types.

    For the I32LP16 multilibs that use -mint32 int is wider than size_t
    and so arithmetic expressions involving size_t promote to int. This
    means we need some explicit casts back to size_t.

    libstdc++-v3/ChangeLog:

            PR libstdc++/107801
            * src/c++17/memory_resource.cc (chunk::_M_bytes): Change type
            from uint32_t to bitset::size_type. Adjust static assertion.
            (__pool_resource::_Pool::replenish): Cast to size_t after
            multiplication instead of before.
            (__pool_resource::_M_alloc_pools): Ensure both arguments to
            std::max have type size_t.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
  2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
                   ` (13 preceding siblings ...)
  2022-11-28 16:57 ` cvs-commit at gcc dot gnu.org
@ 2022-11-28 17:01 ` redi at gcc dot gnu.org
  2022-11-30  0:42 ` jdx at o2 dot pl
                   ` (6 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-28 17:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

--- Comment #14 from Jonathan Wakely <redi at gcc dot gnu.org> ---
src/c++17/memory_resource.cc builds now with trunk, but I still get the
assembler errors for src/c++17/fs_dir.cc

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
  2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
                   ` (14 preceding siblings ...)
  2022-11-28 17:01 ` redi at gcc dot gnu.org
@ 2022-11-30  0:42 ` jdx at o2 dot pl
  2022-11-30  1:48 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jdx at o2 dot pl @ 2022-11-30  0:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

--- Comment #15 from Jan Dubiec <jdx at o2 dot pl> ---
I have applied the patch manually to 12.2 tree and this time got following
error message:

/bin/sh ../../libtool --tag CXX --tag disable-shared   --mode=compile
/d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include  -mn
-mint32 -I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++   -std=gnu++17 -nostdinc++  
-fno-implicit-templates  -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2 
-fdiagnostics-show-location=once   -ffunction-sections -fdata-sections 
-frandom-seed=floating_from_chars.lo  -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include  -mn -mint32  -c -o
floating_from_chars.lo
../../../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/floating_from_chars.cc
libtool: compile:  /d/Works/xcomp/gcc-build/./gcc/xgcc -shared-libgcc
-B/d/Works/xcomp/gcc-build/./gcc -nostdinc++
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/src
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/src/.libs
-L/d/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/libsupc++/.libs
-B/usr/local/h8300-elf/bin/ -B/usr/local/h8300-elf/lib/ -isystem
/usr/local/h8300-elf/include -isystem /usr/local/h8300-elf/sys-include -mn
-mint32 -I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/../libgcc
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include/h8300-elf
-I/d/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include
-I/d/Works/xcomp/gcc-12.2.0/libstdc++-v3/libsupc++ -std=gnu++17 -nostdinc++
-fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2
-fdiagnostics-show-location=once -ffunction-sections -fdata-sections
-frandom-seed=floating_from_chars.lo -fimplicit-templates -isystem
/d/Works/xcomp/sysroot/h8300-elf/include -mn -mint32 -c
../../../../../../../gcc-12.2.0/libstdc++-v3/src/c++17/floating_from_chars.cc
-o floating_from_chars.o
In file included from
D:/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include/bits/basic_string.h:47,
                 from
D:/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include/string:53,
                 from
d:\works\xcomp\gcc-12.2.0\libstdc++-v3\src\c++17\floating_from_chars.cc:36:
D:/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include/string_view:
In member function 'std::basic_string_view<_CharT, _Traits>::size_type
std::basic_string_view<_CharT, _Traits>::copy(_CharT*, size_type, size_type)
const':
D:/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include/string_view:301:42:
error: no matching function for call to 'min(std::basic_string_view<_CharT,
_Traits>::size_type&, int)'
  301 |         const size_type __rlen = std::min(__n, _M_len - __pos);
      |                                  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from
D:/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include/array:43,
                 from
d:\works\xcomp\gcc-12.2.0\libstdc++-v3\src\c++17\floating_from_chars.cc:33:
D:/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include/bits/stl_algobase.h:230:5:
note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&,
const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
D:/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include/bits/stl_algobase.h:230:5:
note:   template argument deduction/substitution failed:
D:/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include/string_view:301:42:
note:   deduced conflicting types for parameter 'const _Tp' ('short unsigned
int' and 'int')
  301 |         const size_type __rlen = std::min(__n, _M_len - __pos);
      |                                  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
D:/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include/bits/stl_algobase.h:278:5:
note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp&
std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
D:/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include/bits/stl_algobase.h:278:5:
note:   template argument deduction/substitution failed:
D:/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include/string_view:301:42:
note:   deduced conflicting types for parameter 'const _Tp' ('short unsigned
int' and 'int')
  301 |         const size_type __rlen = std::min(__n, _M_len - __pos);
      |                                  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
D:/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include/string_view:
In member function 'constexpr std::basic_string_view<_CharT, _Traits>
std::basic_string_view<_CharT, _Traits>::substr(size_type, size_type) const':
D:/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include/string_view:312:42:
error: no matching function for call to 'min(std::basic_string_view<_CharT,
_Traits>::size_type&, int)'
  312 |         const size_type __rlen = std::min(__n, _M_len - __pos);
      |                                  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
D:/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include/bits/stl_algobase.h:230:5:
note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&,
const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
D:/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include/bits/stl_algobase.h:230:5:
note:   template argument deduction/substitution failed:
D:/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include/string_view:312:42:
note:   deduced conflicting types for parameter 'const _Tp' ('short unsigned
int' and 'int')
  312 |         const size_type __rlen = std::min(__n, _M_len - __pos);
      |                                  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
D:/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include/bits/stl_algobase.h:278:5:
note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp&
std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
D:/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include/bits/stl_algobase.h:278:5:
note:   template argument deduction/substitution failed:
D:/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/include/string_view:312:42:
note:   deduced conflicting types for parameter 'const _Tp' ('short unsigned
int' and 'int')
  312 |         const size_type __rlen = std::min(__n, _M_len - __pos);
      |                                  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
make[9]: *** [Makefile:585: floating_from_chars.lo] Error 1
make[9]: Leaving directory
'/d/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/src/c++17'
make[8]: *** [Makefile:781: all-recursive] Error 1
make[8]: Leaving directory
'/d/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3/src'
make[7]: *** [Makefile:576: all-recursive] Error 1
make[7]: Leaving directory
'/d/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3'
make[6]: *** [Makefile:501: all] Error 2
make[6]: Leaving directory
'/d/Works/xcomp/gcc-build/h8300-elf/normal/int32/libstdc++-v3'
make[5]: *** [Makefile:870: multi-do] Error 1
make[5]: Leaving directory '/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3'
make[4]: *** [Makefile:840: all-multi] Error 2
make[4]: Leaving directory '/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3'
make[3]: *** [Makefile:576: all-recursive] Error 1
make[3]: Leaving directory '/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3'
make[2]: *** [Makefile:501: all] Error 2
make[2]: Leaving directory '/d/Works/xcomp/gcc-build/h8300-elf/libstdc++-v3'
make[1]: *** [Makefile:12297: all-target-libstdc++-v3] Error 2
make[1]: Leaving directory '/d/Works/xcomp/gcc-build'
make: *** [Makefile:1043: all] Error 2

Note "-mn -mint32" options – normal mode with 32-bit integers.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
  2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
                   ` (15 preceding siblings ...)
  2022-11-30  0:42 ` jdx at o2 dot pl
@ 2022-11-30  1:48 ` redi at gcc dot gnu.org
  2022-12-04 11:59 ` jdx at o2 dot pl
                   ` (4 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-30  1:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

--- Comment #16 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Already fixed on trunk, see g:a7b97a1f6b9d4993545525fd5cb334ae640ddf45

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
  2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
                   ` (16 preceding siblings ...)
  2022-11-30  1:48 ` redi at gcc dot gnu.org
@ 2022-12-04 11:59 ` jdx at o2 dot pl
  2023-05-16 12:50 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jdx at o2 dot pl @ 2022-12-04 11:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

--- Comment #17 from Jan Dubiec <jdx at o2 dot pl> ---
Thanks Jonathan. I have also applied g:7b79fa930917da735f02b4f6911dfbb0a91f9714
and finally successfully built libstdc++, however there is a bunch of warnings
for review. There are no assembler errors for src/c++17/fs_dir.cc in 12.2
(binutils 2.39).

A question regarding g:75e562d2c4303d3918be9d1563284b0c580c5e45 in relation to
g:a7b97a1f6b9d4993545525fd5cb334ae640ddf45 – don't you think that

          _M_blocks_per_chunk = std::min<size_t>({
              max_blocks,
              __opts.max_blocks_per_chunk,
              _M_blocks_per_chunk * 2
          });

looks nicer than

          _M_blocks_per_chunk = std::min({
              max_blocks,
              __opts.max_blocks_per_chunk,
              size_t(_M_blocks_per_chunk * 2)
          });

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
  2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
                   ` (17 preceding siblings ...)
  2022-12-04 11:59 ` jdx at o2 dot pl
@ 2023-05-16 12:50 ` cvs-commit at gcc dot gnu.org
  2023-05-16 15:37 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-16 12:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

--- Comment #18 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

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)

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
  2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
                   ` (18 preceding siblings ...)
  2023-05-16 12:50 ` cvs-commit at gcc dot gnu.org
@ 2023-05-16 15:37 ` cvs-commit at gcc dot gnu.org
  2023-05-16 16:16 ` cvs-commit at gcc dot gnu.org
  2023-05-16 16:17 ` redi at gcc dot gnu.org
  21 siblings, 0 replies; 23+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-16 15:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

--- Comment #19 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:e6baa800897728fac40fc7153facaf3c7541ff3f

commit r12-9541-ge6baa800897728fac40fc7153facaf3c7541ff3f
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Nov 28 13:28:53 2022 +0000

    libstdc++: Fix src/c++17/memory_resource for H8 targets [PR107801]

    This fixes compilation failures for H8 multilibs. For the normal
    multilib (ILP16L32?), the chunk struct does not have the expected size,
    because uint32_t is type long and has alignment 4 (by default). This
    forces sizeof(chunk) to be 12 instead of the expected 10. We can fix
    that by using bitset::size_type instead of uint32_t, so that we only use
    a 16-bit size when size_t and pointers are 16-bit types.

    For the IL32P16 multilibs that use -mint32, int is wider than size_t
    and so arithmetic expressions involving size_t promote to int. This
    means we need some explicit casts back to size_t.

    libstdc++-v3/ChangeLog:

            PR libstdc++/107801
            * src/c++17/memory_resource.cc (chunk::_M_bytes): Change type
            from uint32_t to bitset::size_type. Adjust static assertion.
            (__pool_resource::_Pool::replenish): Cast to size_t after
            multiplication instead of before.
            (__pool_resource::_M_alloc_pools): Ensure both arguments to
            std::max have type size_t.

    (cherry picked from commit 75e562d2c4303d3918be9d1563284b0c580c5e45)

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
  2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
                   ` (19 preceding siblings ...)
  2023-05-16 15:37 ` cvs-commit at gcc dot gnu.org
@ 2023-05-16 16:16 ` cvs-commit at gcc dot gnu.org
  2023-05-16 16:17 ` redi at gcc dot gnu.org
  21 siblings, 0 replies; 23+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-16 16:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

--- Comment #20 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:23e12322bc03065557d9c0ee238b5b8d7b605c02

commit r11-10777-g23e12322bc03065557d9c0ee238b5b8d7b605c02
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Nov 28 13:28:53 2022 +0000

    libstdc++: Fix src/c++17/memory_resource for H8 targets [PR107801]

    This fixes compilation failures for H8 multilibs. For the normal
    multilib (ILP16L32?), the chunk struct does not have the expected size,
    because uint32_t is type long and has alignment 4 (by default). This
    forces sizeof(chunk) to be 12 instead of the expected 10. We can fix
    that by using bitset::size_type instead of uint32_t, so that we only use
    a 16-bit size when size_t and pointers are 16-bit types.

    For the IL32P16 multilibs that use -mint32, int is wider than size_t
    and so arithmetic expressions involving size_t promote to int. This
    means we need some explicit casts back to size_t.

    libstdc++-v3/ChangeLog:

            PR libstdc++/107801
            * src/c++17/memory_resource.cc (chunk::_M_bytes): Change type
            from uint32_t to bitset::size_type. Adjust static assertion.
            (__pool_resource::_Pool::replenish): Cast to size_t after
            multiplication instead of before.
            (__pool_resource::_M_alloc_pools): Ensure both arguments to
            std::max have type size_t.

    (cherry picked from commit 75e562d2c4303d3918be9d1563284b0c580c5e45)

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc)
  2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
                   ` (20 preceding siblings ...)
  2023-05-16 16:16 ` cvs-commit at gcc dot gnu.org
@ 2023-05-16 16:17 ` redi at gcc dot gnu.org
  21 siblings, 0 replies; 23+ messages in thread
From: redi at gcc dot gnu.org @ 2023-05-16 16:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #21 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Should be fixed for 11.4 and 12.4 as well.

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2023-05-16 16:17 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-22  4:56 [Bug libstdc++/107801] New: Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) jdx at o2 dot pl
2022-11-22  9:08 ` [Bug libstdc++/107801] " redi at gcc dot gnu.org
2022-11-22  9:10 ` redi at gcc dot gnu.org
2022-11-22  9:20 ` redi at gcc dot gnu.org
2022-11-22 10:39 ` cvs-commit at gcc dot gnu.org
2022-11-22 11:06 ` cvs-commit at gcc dot gnu.org
2022-11-22 17:05 ` jdx at o2 dot pl
2022-11-22 17:09 ` redi at gcc dot gnu.org
2022-11-23  5:16 ` jdx at o2 dot pl
2022-11-26 21:41 ` pinskia at gcc dot gnu.org
2022-11-27  2:31 ` jdx at o2 dot pl
2022-11-27  7:35 ` redi at gcc dot gnu.org
2022-11-28 12:10 ` redi at gcc dot gnu.org
2022-11-28 13:32 ` redi at gcc dot gnu.org
2022-11-28 16:57 ` cvs-commit at gcc dot gnu.org
2022-11-28 17:01 ` redi at gcc dot gnu.org
2022-11-30  0:42 ` jdx at o2 dot pl
2022-11-30  1:48 ` redi at gcc dot gnu.org
2022-12-04 11:59 ` jdx at o2 dot pl
2023-05-16 12:50 ` cvs-commit at gcc dot gnu.org
2023-05-16 15:37 ` cvs-commit at gcc dot gnu.org
2023-05-16 16:16 ` cvs-commit at gcc dot gnu.org
2023-05-16 16:17 ` redi at gcc dot gnu.org

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).