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]

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


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