diff options
author | Richard Biener <rguenther@suse.de> | 2025-01-29 08:58:39 +0100 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2025-01-29 10:29:01 +0100 |
commit | 7b02b8f65ef60be77f3f93945e2a6b463edaa0aa (patch) | |
tree | 1f86e08800c9d54a0f08ff9cb5c217f5bd460a1d /gcc/expr.cc | |
parent | 3a6ddbf7b241e1cd9f73495ea373b0a12015bb07 (diff) | |
download | gcc-7b02b8f65ef60be77f3f93945e2a6b463edaa0aa.zip gcc-7b02b8f65ef60be77f3f93945e2a6b463edaa0aa.tar.gz gcc-7b02b8f65ef60be77f3f93945e2a6b463edaa0aa.tar.bz2 |
middle-end/118684 - fix fallout of wrong stack local alignment fix
When we expand BIT_FIELD_REF <x_2(D), 8, 8> we can end up creating
a stack local, running into the fix. But get_object_alignment
will return 8 for any SSA_NAME because that's not an "object" we
handle. Deal with handled components on registers by singling out
SSA_NAME bases, using their type alignment instead of
get_object_alignment (I considered "robustifying" get_object_alignment,
but decided not to at this point).
This fixes an ICE on gcc.dg/pr41123.c on arm as reported by the CI.
PR middle-end/118684
* expr.cc (expand_expr_real_1): When creating a stack local
during expansion of a handled component, when the base is
a SSA_NAME use its type alignment and avoid calling
get_object_alignment.
* gcc.dg/pr118684.c: Require automatic_stack_alignment.
Diffstat (limited to 'gcc/expr.cc')
-rw-r--r-- | gcc/expr.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/expr.cc b/gcc/expr.cc index 95f41f6..7f3149b 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -12152,7 +12152,9 @@ 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, - get_object_alignment (tem)); + TREE_CODE (tem) == SSA_NAME + ? TYPE_ALIGN (TREE_TYPE (tem)) + : get_object_alignment (tem)); emit_move_insn (memloc, op0); op0 = memloc; clear_mem_expr = true; |