This is the mail archive of the
mailing list for the GCC project.
Re: PR18173 - can't force alignment of global arrays with static initializer?
- From: Geoffrey Keating <geoffk at geoffk dot org>
- To: Dorit Naishlos <DORIT at il dot ibm dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 23 Nov 2004 15:55:18 -0800
- Subject: Re: PR18173 - can't force alignment of global arrays with static initializer?
- References: <OF0EE172CB.AAF45097-ONC2256F55.006C9A80-C2256F55.006DE1D2@il.ibm.com>
Dorit Naishlos <DORIT@il.ibm.com> writes:
> The problem in PR18173 seems to be related to the alignment of global
> arrays with static initialization: We force the alignment of arrays in the
> vectorizer by setting the DECL_ALIGN field. This does not seem to work for
> global arrays with static initialization - DECL_ALIGN seems to be reset to
> TYPE_ALIGN somewhere along the way. The patch below fixes the problem by
> having the function 'vect_can_force_dr_alignment_p' return false for decls
> with static initializer (is that a correct check?). The question is - is it
> really impossible to force the alignment of such decls, or is it a bug that
> the setting of DECL_ALIGN doesn't work?
I'm actually not sure why DECL_ALIGN exists, it should really always
be equal to TYPE_ALIGN. What you do if you want to change the
alignment is you create a new type that's the same as the previous one
but with a different TYPE_ALIGN, and then change the decl's type, and
then maybe re-layout the decl.