And
--- gcc/expr.cc.jj      2024-01-12 10:07:58.194851657 +0100
+++ gcc/expr.cc 2024-01-18 12:08:16.412147569 +0100
@@ -12382,6 +12382,21 @@ expand_expr_real_1 (tree exp, rtx target
          }
       }
 
+      /* Ensure non-BLKmode array VAR_DECLs VCEd to BLKmode BITINT_TYPE
+        aren't promoted to registers.  */
+      if (op0 == NULL_RTX
+         && mode == BLKmode
+         && TREE_CODE (type) == BITINT_TYPE
+         && modifier == EXPAND_NORMAL
+         && VAR_P (treeop0)
+         && DECL_MODE (treeop0) != BLKmode)
+       {
+         op0 = expand_expr_real (treeop0, NULL_RTX, VOIDmode, EXPAND_MEMORY,
+                                 NULL, inner_reference_p);
+         if (MEM_P (op0))
+           op0 = adjust_address (op0, BLKmode, 0);
+       }
+
       if (!op0)
        op0 = expand_expr_real (treeop0, NULL_RTX, VOIDmode, modifier,
                                NULL, inner_reference_p);
helps at -O0, but doesn't at -O2, where even EXPAND_MEMORY doesn't actually
cause MEM_P result, it is still forced into a REG.

        Jakub

Reply via email to