op0 = convert_modes (mode, GET_MODE (op0), op0,
TYPE_UNSIGNED (TREE_TYPE (treeop0)));
/* If the output type is a bit-field type, do an extraction. */
- else if (reduce_bit_field && mode != BLKmode)
+ else if (reduce_bit_field
+ && mode != BLKmode
+ && (MEM_P (op0) || !COMPLEX_MODE_P (GET_MODE (op0))))
return extract_bit_field (op0, TYPE_PRECISION (type), 0,
TYPE_UNSIGNED (type), NULL_RTX,
mode, mode, false, NULL);
emit_move_insn (target, op0);
op0 = target;
+
+ if (reduce_bit_field && mode != BLKmode)
+ return extract_bit_field (op0, TYPE_PRECISION (type), 0,
+ TYPE_UNSIGNED (type), NULL_RTX,
+ mode, mode, false, NULL);
}
/* If OP0 is (now) a MEM, we need to deal with alignment issues. If the
--- /dev/null
+/* PR middle-end/117458 */
+/* { dg-do compile { target bitint } } */
+/* { dg-options "-std=c23 -O2" } */
+
+typedef _BitInt(33) B __attribute__((may_alias));
+
+_BitInt(33)
+foo (_Complex float x)
+{
+ return *(B *)&x;
+}