https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123176
--- Comment #3 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> --- > --- Comment #2 from Luc Grosheintz <luc.grosheintz at gmail dot com> --- [...] > The question is now is `int8_t` allowed to be `char`? There's > https://eel.is/c++draft/cstdint.syn > > which isn't very explicit, but it does state: > using int8_t = signed integer type; // optional > > There's also cppreference: > > std::int8_t may be signed char and std::uint8_t may be unsigned char, but > neither can be char regardless of its signedness (because char is not > considered a "signed integer type" or "unsigned integer type"). > > https://en.cppreference.com/w/cpp/types/integer.html > > Even if Solaris where wrong about typedeffing int8_t as `char` (and not > `signed > char`), I doubt that will be fixed to make `mdspan` work. In those tests, the > use of int8_t isn't important, it's just any type that's different from `int`. > Hence, I can easily change it to `signed char`; and the test would still work > as intended and would hopefully fails as intended on Solaris too (they're neg > tests, so failing is good). Indeed it won't: * <sys/isa_defs.h> has * _CHAR_IS_UNSIGNED / _CHAR_IS_SIGNED: * The C Compiler implements objects of type `char' as `unsigned' or * `signed' respectively. This is really an implementation choice of * the compiler writer, but it is specified in the ABI and tends to * be uniform across compilers for an instruction set architecture. * Hence, it has the properties of a processor characteristic. and _CHAR_IS_SIGNED is defined for both sparc and x86. * Likewise, in <sys/int_types.h> we have /* * Basic / Extended integer types * * The following defines the basic fixed-size integer types. * * Implementations are free to typedef them to Standard C integer types or * extensions that they support. If an implementation does not support one * of the particular integer data types below, then it should not define the * typedefs and macros corresponding to that data type. Note that int8_t * is not defined in -Xs mode on ISAs for which the ABI specifies "char" * as an unsigned entity because there is no way to define an eight bit * signed integral. */ #if defined(_CHAR_IS_SIGNED) typedef char int8_t; #else #if defined(__STDC__) typedef signed char int8_t; #endif #endif which matches the SPARC and i386 psABIs: * System V Application Binary Interface, SPARC Processor Supplement, Third Edition, p. 3-2, Figure 3-1: Scalar Types: Alignment Type C sizeof (bytes) SPARC Integral char 1 1 signed byte signed char * System V Application Binary Interface, Intel38 Architecture Processor Supplement, Fourth Edition, p. 3-2 equivalent That's the origin of the _CHAR_IS_SIGNED setting. Neither has anything on int8_t, though. However, the Sparc Compliance Definition 2.4.1, 6P-13, Figure 6-140: <inttypes.h> lists typedef signed char int8_t; I suspect that this wasn't used to maintain compatibility with the existing 32-bit definition. Whatever the case, this certainly isn't going to be changed now.
