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

--- Comment #6 from joseph at codesourcery dot com <joseph at codesourcery dot 
com> ---
It's _BitInt in C2X, see N2763 for the final wording.  The operator for 
computing the width of a type, present in earlier drafts, was removed to 
get a minimal version into C2X; I don't know if it will be re-proposed in 
time for C2X (as it's a previously proposed feature, the deadline would be 
the January meeting of WG14; the deadline two weeks ago was for *initial* 
proposal of new features).

Note the importance of agreeing the ABI with the relevant ABI working 
groups!  And that the ABI needs to be clear about whether padding bits 
have defined values (in the in-memory representation, and in argument 
passing and return).  A proposed x86_64 ABI is on a branch of the ABI 
repository (not yet on master).  I'm not aware of proposals for the ABI 
for other architectures.

As a required C2X feature, we'll need some default for the ABI for 
architectures that haven't made another choice (which might closely follow 
what x86_64 does, for example), but we should try to get architecture 
maintainers all to explicitly consider the ABI issue, and to work with ABI 
maintainers / other implementations where applicable to agree what the ABI 
should be on that architecture.  Anyone interested in this feature can 
work with ABI working groups for various architectures *now* to agree on 
what the ABI should be, they don't need to be working on an 
implementation.

(For GCC, we also need an ABI for _Complex _BitInt, unless we disallow 
that, though complex integers are outside the scope of C2X.)

There is a proposal (N2858) for printf/scanf support for _BitInt.  
Implementing that in glibc (or any other C library) will require 
architecture-specific code to read the values of arguments, given that (a) 
we can't call va_arg with a type of run-time-determined size, unless there 
is a pretty small limit on the sizes we support with _BitInt and (b) we 
might want to support that feature in glibc well before it's desirable to 
depend on a GCC with _BitInt support for building glibc.  ABIs like the 
x86_64 one (treating the argument like a standard integer type or a 
struct) should be OK for that purpose, since once the size gets 
sufficiently large (depending on the ABI), a repeated sequence of va_arg 
calls should suffice to read the structure elements (or a va_arg call for 
a pointer type, when passed by reference).

Reply via email to