https://gcc.gnu.org/bugzilla/show_bug.cgi?id=129228

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |17.0
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2026-12-02

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Seems assign_stack_local_2 is doing some weird bigend_correction, so calling
assign_stack_for_temp with e.g. DImode and size 48 bytes (array of 6 DImode
elts) doesn't work properly there.

--- a/gcc/internal-fn.cc        2026-11-29 18:42:22.706910134 +0100
+++ b/gcc/internal-fn.cc        2026-12-02 09:27:35.241865173 +0100
@@ -6887,7 +6887,10 @@ expand_BITEXPAND (internal_fn, gcall *st
   if (tem != mk)
     emit_move_insn (mk, tem);
   unsigned log2_prec1 = ceil_log2 (prec1);
-  rtx array = assign_stack_temp (wmode, log2_prec1 * GET_MODE_SIZE (wmode));
+  tree wtype = lang_hooks.types.type_for_mode (wmode, 1);
+  tree atype = build_array_type_nelts (wtype, log2_prec1);
+  rtx array = assign_stack_temp_for_type (TYPE_MODE (atype),
+                                         int_size_in_bytes (atype), atype);
   rtx array_addr = force_reg (GET_MODE (XEXP (array, 0)), XEXP (array, 0));
   rtx i = gen_reg_rtx (TYPE_MODE (integer_type_node));
   emit_move_insn (i, const0_rtx);

seems to fix this for me.

Reply via email to