With the current handling of decl alignments it is impossible to reduce the alignment requirement as part of a variable declaration.
This change has been proposed by Richard in the PR. It fixes the align-1.c testcase on IBM Z. Bootstrapped on x86_64 and s390x. No regressions. Ok for mainline? gcc/ChangeLog: PR middle-end/88085 * emit-rtl.c (set_mem_attributes_minus_bitpos): Use the user alignment if there are no pre-existing mem attrs. --- gcc/emit-rtl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 07e908624a0..fc12fa927da 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -2124,7 +2124,7 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp, unsigned int diff_align = known_alignment (obj_bitpos - bitpos); if (diff_align != 0) obj_align = MIN (obj_align, diff_align); - attrs.align = MAX (attrs.align, obj_align); + attrs.align = refattrs ? MAX (refattrs->align, obj_align) : obj_align; } poly_uint64 const_size; -- 2.30.2