This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PR18173 - can't force alignment of global arrays with static initializer?
- From: Dorit Naishlos <DORIT at il dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 23 Nov 2004 22:00:12 +0200
- Subject: PR18173 - can't force alignment of global arrays with static initializer?
Hi,
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?
thanks,
dorit
Changelog:
* tree-vectorizer.c (vect_can_force_dr_alignment_p): Return false for
decls
with static initializers.
Patch:
*************** vect_can_force_dr_alignment_p (tree decl
*** 1510,1515 ****
--- 1509,1517 ----
if (DECL_EXTERNAL (decl))
return false;
+ if (DECL_INITIAL (decl))
+ return false;
+
if (TREE_STATIC (decl))
return (alignment <= MAX_OFILE_ALIGNMENT);
else