Bug#995916: std::stoi, std::stol, std::stoul, ... broken on sh4

Mattias Ellert <[email protected]> Fri, 08 Oct 2021 09:54:11 +0200
Newsgroups gmane.linux.debian.ports.superh
Message-ID <3ff6290a2e185fd0cc7d2d2c06c8ce3aed12269f.camel__11285.374597513$1633679854$gmane$org@physics.uu.se>
Source: gcc-10
Version: 10.3.0-11
Severity: important
User: [email protected]
Usertags: sh4
X-Debbugs-Cc: [email protected]
Control: affects -1 cmake ceph

Here is a failure from a recent build of "cmake" on sh4:
https://buildd.debian.org/status/fetch.php?pkg=cmake&arch=sh4&ver=3.21.3-4&stamp=1633638401&raw=0

g++ -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2    -D_FILE_OFFSET_BITS=64    -DCMAKE_BOOTSTRAP    -DCMake_HAVE_CXX_MAKE_UNIQUE=1   -I/<<PKGBUILDDIR>>/Build/Bootstrap.cmk   -I/<<PKGBUILDDIR>>/Source   -I/<<PKGBUILDDIR>>/Source/LexerParser   -I/<<PKGBUILDDIR>>/Utilities/std   -I/<<PKGBUILDDIR>>/Utilities  -c /<<PKGBUILDDIR>>/Source/cmFileCopier.cxx -o cmFileCopier.o
/<<PKGBUILDDIR>>/Source/cmFileCommand.cxx: In function ‘bool {anonymous}::HandleArchiveCreateCommand(const std::vector<std::__cxx11::basic_string<char> >&, cmExecutionStatus&)’:
/<<PKGBUILDDIR>>/Source/cmFileCommand.cxx:3473:45: error: invalid initialization of reference of type ‘const wstring&’ {aka ‘const std::__cxx11::basic_string<wchar_t>&’} from expression of type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’}
 3473 |     compressionLevel = std::stoi(parsedArgs.CompressionLevel);
      |                                  ~~~~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/10/string:55,
                 from /<<PKGBUILDDIR>>/Source/cmFileCommand.h:7,
                 from /<<PKGBUILDDIR>>/Source/cmFileCommand.cxx:3:
/usr/include/c++/10/bits/basic_string.h:6699:23: note: in passing argument 1 of ‘int std::__cxx11::stoi(const wstring&, std::size_t*, int)’
 6699 |   stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
      |        ~~~~~~~~~~~~~~~^~~~~
gmake[2]: *** [Makefile:126: cmFileCommand.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[2]: Leaving directory '/<<PKGBUILDDIR>>/Build/Bootstrap.cmk'
---------------------------------------------
Error when bootstrapping CMake:


The std::stoi, std::stol, std::stoul, ... functions should be available
in two versions. One accepting a std::string and one accepting a
std::wstring.

In g++ version 10.3.0-11 on sh4 only the std::wstring version is
available, so when it tries to compile code that uses the std::string
version it fails.

The problem is that for some reason the the file

/usr/include/sh4-linux-gnu/c++/10/bits/c++config.h

provided by libstdc++-10-dev_10.3.0-11_sh4.deb contains the line

/* #undef _GLIBCXX11_USE_C99_STDLIB */

The corresponding file for other architectures contains

#define _GLIBCXX11_USE_C99_STDLIB 1

This is a regression wrt earlier versions, since this used to work
without problems.

	Mattias Ellert
signature.asc (application/pgp-signature, 874 B)
-----BEGIN PGP SIGNATURE-----

iQJRBAABCAA7FiEE6hgwr99NQxrZ4RRS6K7C/zvhqUsFAmFf+SQdHG1hdHRpYXMu
ZWxsZXJ0QHBoeXNpY3MudXUuc2UACgkQ6K7C/zvhqUskHBAAoUb6blYGIlQGSZap
jUaS/QAd5mzrJNm0FV7fbkwc+wAs2zjMaMcs58gzvxO6cwGKL/ZX9iC/uPf1mo0i
acfJzaWgElywA+CUDGx3sgRvbZKLxa32M/2tpC2of7w5a+PlPTgzqDZvC896MbJ1
5g+AoCj2GaRuJYYcUh/NPeZVeaI91xy6pxJIYGolMeW01poyKZnQtVH0ASMv0UKa
Oqpm12cJkk693l9ZZELTZXutbR/fmQ4t9HyFooIX+E82UjvvPSvVjMi8urF/hkpR
4TYcKdUhOVoR8kmcuKw0Jfc/n3TglmvAh1OsyIXkYBovV2d2mZNL6c8jRik2X4X4
9Msh9ZYA8cCaWO/E5R0Gwm1rtA/eu8hfD5VnyO6LlEVYj1twN0zXUpFodcLJSaZp
VtavUhjxXwOc15SlVepFImv6+Rc705yF4RP6W/S9mJVM4FN5+JoqKNIYpZHuKRJq
EkGVVJJ5Prmdwm0opNq5L1JRUGdVbL3Mdg7wsUD/pf7VEqpSSRFgkgw6xb1daYrG
VuF/oL7n11GCZoy0oM28CvuQpEIU/TY13lVaYVmNCXIv2OZPMZ63y655HCGPUY9q
fWCd50RLnL1HuTUAAkYjT0A4Y0qEwJLYETfh02ACXS+LhWokNJ2g1xWr0evO3ApJ
dvoF0lcxKNQoolb+RNiaL6oujyo=
=6715
-----END PGP SIGNATURE-----