gustedt added a comment.

>> Also discussing consequences for `va_arg` functions such as `printf` would 
>> be nice.
>
> Does the information in the `Passing and Returning an Object` section 
> suffice, or are there more details you're looking for there?

The narrow `_BitInt` types are not promoted to `int` for arithmetic.

For the function call ABI we would need to know if the same strategy holds for 
`va_arg` parameters. For each of these types with representing standard integer 
type `T` two scenarios would be possible

- When passed to a `va_arg` function the same rules for `T` as an argument for 
a prototyped function parameter apply.
- When passed to a `va_arg` function the value is promoted as if it where a 
`T`, that is in general there is a promotion to `int`.

This has in particular implications to whether or not the `wN` length modifier 
for `printf` and `scanf` can be used for narrow `_BitInt` types or not: in the 
first scenario that would not be possible in the second in would be possible 
without problems.

I would be much in favor of the second choice, `va_arg` functions usually are 
not made to handle narrow input well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115169/new/

https://reviews.llvm.org/D115169

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D115169: Create a ge... Jens Gustedt via Phabricator via cfe-commits

Reply via email to