This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: PR middle-end/48608: Alignment adjust of local variables is lost


On Thu, Apr 14, 2011 at 5:48 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Apr 14, 2011 at 8:26 AM, Michael Matz <matz@suse.de> wrote:
>> Hi,
>>
>> On Thu, 14 Apr 2011, Richard Guenther wrote:
>>
>>> > + ?if (align > DECL_ALIGN (decl))
>>> > + ? ?DECL_ALIGN (decl) = align;
>>>
>>> Shouldn't this unconditionally set DECL_ALIGN in case
>>> LOCAL_DECL_ALINGMENT returns something smaller?
>>
>> Decreasing alignment of DECLs points to a problem elsewhere, so perhaps an
>> assert that this doesn't happen is better. ?Decreasing is a problem
>> because it's not conservative: there might have been code generated
>> already assuming the once larger alignment that then possibly breaks if it
>> turns out the alignment is actually smaller.
>
> ia32 may decrease local variable alignment:
>
> ?/* Don't do dynamic stack realignment for long long objects with
> ? ? -mpreferred-stack-boundary=2. ?*/
> ?if (!TARGET_64BIT
> ? ? ?&& align == 64
> ? ? ?&& ix86_preferred_stack_boundary < 64
> ? ? ?&& (mode == DImode || (type && TYPE_MODE (type) == DImode))
> ? ? ?&& (!type || !TYPE_USER_ALIGN (type))
> ? ? ?&& (!decl || !DECL_USER_ALIGN (decl)))
> ? ?align = 32;
>
> I am running bootstrap/test on Linux/x86-64 and Linux/ia32.

That's broken.  It may cause explicit alignment checks to be bogously
optimized away.

Richard.

> --
> H.J.
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]