https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115405
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- It's not visible but I assume that _4 doesn't have _BitInt(17) type? The if (known_eq (offset, 0) && !reverse && poly_int_tree_p (TYPE_SIZE (type), &type_size) && known_eq (GET_MODE_BITSIZE (DECL_MODE (base)), type_size)) check tries to assess that no extension is required, does it work if you adjust that for the _BitInt case? OTOH the reduce_bit_field handling in VIEW_CONVERT_EXPR expansion looks misplaced - shouldn't it be before the INTEGRAL_TYPE_P handling?