Hi Jakub: Thanks for your correction, I read the doc for the aligned attribute again[1], it's minimum alignment not restricted alignment, I thought it should honor to the alignment attribute, Richard Biener suggested[2] should put an assertion here to make sure never decrease alignment here, so I'll send another patch for add assertion.
[1] https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#Common-Type-Attributes [2] https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542808.html On Mon, Mar 30, 2020 at 7:21 PM Jakub Jelinek <ja...@redhat.com> wrote: > > On Mon, Mar 30, 2020 at 06:31:27PM +0800, Kito Cheng wrote: > > gcc/ChangeLog > > > > * cfgexpand.c (align_local_variable): Check DECL_USER_ALIGN. > > Why? LOCAL_DECL_ALIGNMENT surely shouldn't decrease alignment of decls > with DECL_USER_ALIGN vars (but do you have evidence that it does), > but it is just fine to increase alignment of vars with explicit alignment > requirements if the compiler thinks it is beneficial. Larger alignment > still satisfies the user requirement... > > Jakub >