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

            Bug ID: 111309
           Summary: va_arg alternative for _BitInt
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

For https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2858.pdf , I wonder if we
shouldn't have a __builtin_va_arg variant which would allow to read arbitrary
_BitInt
into array of limbs.  The builtin IMHO should be passed at least the N from
_BitInt(N), probably whether it is signed vs. unsigned and pointer to the array
of limbs, dunno whether it should only support limb type which it also uses for
the libgcc APIs or whether the type should be e.g. inferred from the scalar
integer type the pointer argument points to.  And whether the endianity in
which limbs are ordered should be host endianity, some other argument to the
builtin, or always the _BitInt endianity.
On arches like x86-64 where the passing ABI says for N <= 8 pass like char, for
N <= 16 pass like short, for N <= 32 pass like int, for N <= 64 pass like long
long, otherwise pass like struct { long long a[(N + 63) / 64]; } it would need
to differentiate at runtime (unless N is constant obviously) the different
cases to perform proper VA_ARG for that, plus handle the generic case which
would be always passed in memory.

Reply via email to