https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115405
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The IL before expansion doesn't have a VCE, just MEM[(_BitInt(17) *)&b] where b has unsigned _BitInt(17) type. Then /* Handle expansion of non-aliased memory with non-BLKmode. That might end up in a register. */ if (mem_ref_refers_to_non_mem_p (exp)) { poly_int64 offset = mem_ref_offset (exp).force_shwi (); base = TREE_OPERAND (base, 0); poly_uint64 type_size; 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)) return expand_expr (build1 (VIEW_CONVERT_EXPR, type, base), target, tmode, modifier); in expr.cc turns that into a VCE. And VCE doesn't really EXTEND_BITINT because the upper bits generally in a VCE are undefined. Finally the NOP_EXPR expansion sees a SImode signed _BitInt(17) extension to SImode 32-bit int and assumes for something in an automatic var to be already properly extended. Dunno where the bug is, whether trying to use VCE for the _BitInt cases as in the snippet above, or VCE not doing EXTEND_BITINT, or NOP_EXPR handling that should extend even in this case.