This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch] PR 65315 - Fix alignment of local variables
- From: Jeff Law <law at redhat dot com>
- To: Steve Ellcey <sellcey at imgtec dot com>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 05 Mar 2015 09:18:57 -0700
- Subject: Re: [Patch] PR 65315 - Fix alignment of local variables
- Authentication-results: sourceware.org; auth=none
- References: <2db74cc6-b63d-4f8b-aa37-525b51b0b34c at BAMAIL02 dot ba dot imgtec dot org>
On 03/04/15 12:50, Steve Ellcey wrote:
While examining some MIPS code I noticed that GCC did not seem to be
fully honoring the aligned attribute on some local variables. I submitted
PR middle-end/65315 to record the bug and I think I now understand it and
have a fix. The problem was that expand_stack_vars seemed to think that
the first entry in stack_vars_sorted would have the largest alignment but
while all the variables that had alignment greater then
MAX_SUPPORTED_STACK_ALIGNMENT would come before all variables whose
alignment was less than MAX_SUPPORTED_STACK_ALIGNMENT, within the variables
with the alignment greater than MAX_SUPPORTED_STACK_ALIGNMENT, they
were sorted by size, not by alignment.
So my fix was to update large_align in expand_stack_vars if needed.
I have verified the fix on the MIPS test case in PR 65315 and am doing a
regression test now. OK to checkin if there are no regressions?
I wasn't sure how to create a generic test case, I was checking the
alignment on MIPS by hand by looking for the shift-right/shift-left
instructions that create an aligned pointer but that obviously doesn't
work on other architectures.
Steve Ellcey
sellcey@imgtec.com
2015-03-04 Steve Ellcey <sellcey@imgtec.com>
PR middle-end/65315
* cfgexpand.c (expand_stack_vars): Update large_align to maximum
needed alignment.
Please include a testcase for the testsuite if at all possible.
OK for the trunk.
jeff