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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
We could possibly extend get_object_alignment to handle constants the same way
we handle COST_DECL, the more conservative fix would be to change

diff --git a/gcc/expr.cc b/gcc/expr.cc
index 70b4eda6df3..0f599464c4f 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -12335,7 +12335,8 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode
tmode,
            if (!poly_int_tree_p (TYPE_SIZE_UNIT (TREE_TYPE (tem)), &size))
              size = max_int_size_in_bytes (TREE_TYPE (tem));
            memloc = assign_stack_local (TYPE_MODE (TREE_TYPE (tem)), size,
-                                        TREE_CODE (tem) == SSA_NAME
+                                        (TREE_CODE (tem) == SSA_NAME
+                                         || CONSTANT_CLASS_P (tem))
                                         ? TYPE_ALIGN (TREE_TYPE (tem))
                                         : get_object_alignment (tem));
            emit_move_insn (memloc, op0);

but I do wonder how we get to 'tem' being a vector constant...

Ah, so we expand

BIT_FIELD_REF <{ 9, -64497, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 256, 0>

which for some reason we have not folded, likely because it's dead.

I do wonder why force_const_mem in the previous if () didn't work out
(it tries to use XImode ...).

OTOH, mode == BLKmode.

That said, I'm not sure this isn't a bug elsewhere and we're just papering
over the issue with the above.

Can you test / submit?

Reply via email to