[Bug c/114657] Invalid type conversion from some _BitInt bit-fields

2024-04-09 Thread jsm28 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114657

--- Comment #3 from Joseph S. Myers  ---
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2958.htm has my analysis of
the various notions of "type" used in relation to bit-fields and the questions
of what expressions are considered to have special properties associated with
referring to a bit-field.

[Bug c/114657] Invalid type conversion from some _BitInt bit-fields

2024-04-09 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114657

--- Comment #2 from Jakub Jelinek  ---
In particular, 6.5.1.1/2 says
"The type of the controlling expression is the type of the expression as if it
had undergone an lvalue conversion, array to pointer conversion, or function to
pointer conversion."
but doesn't list integer promotions (if those were to occur, you'd e.g. never
be able to match a char, signed char, unsigned char, short, unsigned short
types with _Generic because everything would be promoted to int.

[Bug c/114657] Invalid type conversion from some _BitInt bit-fields

2024-04-09 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114657

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org,
   ||jsm28 at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek  ---
I believe Joseph said this isn't well specified in the C standard, see
https://gcc.gnu.org/pipermail/gcc-patches/2023-July/625765.html
If you use something like + 0uwb it should be the type after the integral
promotions and so what the standard specifies for integral promotions of the
_BitInt bit-fields.