https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39843
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2021-08-05 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed. C front-end: /* Adjust the type if a bit-field is being declared, -funsigned-bitfields applied and the type is not explicitly "signed". */ if (bitfield && !flag_signed_bitfields && !declspecs->explicit_signed_p && TREE_CODE (type) == INTEGER_TYPE) type = unsigned_type_for (type); C++ front-end: /* Decide whether an integer type is signed or not. Optionally treat bitfields as signed by default. */ if (unsigned_p /* [class.bit] It is implementation-defined whether a plain (neither explicitly signed or unsigned) char, short, int, or long bit-field is signed or unsigned. Naturally, we extend this to long long as well. Note that this does not include wchar_t. */ || (bitfield && !flag_signed_bitfields && !signed_p /* A typedef for plain `int' without `signed' can be controlled just like plain `int', but a typedef for `signed int' cannot be so controlled. */ && !(typedef_decl && C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl)) && TREE_CODE (type) == INTEGER_TYPE && !same_type_p (TYPE_MAIN_VARIANT (type), wchar_type_node))) { if (explicit_intN) type = int_n_trees[declspecs->int_n_idx].unsigned_type; else if (longlong) type = long_long_unsigned_type_node; else if (long_p) type = long_unsigned_type_node; else if (short_p) type = short_unsigned_type_node; else if (type == char_type_node) type = unsigned_char_type_node; else if (typedef_decl) type = unsigned_type_for (type); else type = unsigned_type_node; } The problem is we have a typedef with aligned attribute on it but in both cases we lose that.