------- Comment #6 from amruth dot laxman at nsn dot com  2007-10-06 15:37 
-------
Based on the feedback below, I'd like to reopen this as an enhancement request.
Rationale for requesting this as an enhancment is as follows:
-> restoring gcc 3.x behavior will ease migration to gcc 4.x on alignment
enforcing platforms (ARM, SPARC, PPC etc.). Without this, the migration will be
painful & slow. I don't think it is in anyone's interest to stay on older
releases.
-> comments in sparc.h clearly indicate a desire to align character arrays:
/* Make strings word-aligned so strcpy from constants will be faster.  */
#define CONSTANT_ALIGNMENT(EXP, ALIGN)  \
...
/* Make arrays of chars word-aligned for the same reasons.  */
#define DATA_ALIGNMENT(TYPE, ALIGN)             \
...

I have attached a patch for the SPARC platform below. This was tested on
Solaris 10, with gcc 4.1.2 and 4.2.1.
diff -cr gcc-4.2.1/gcc/config/sparc/sparc.h
gcc-4.2.1-new/gcc/config/sparc/sparc.h
*** gcc-4.2.1/gcc/config/sparc/sparc.h  Tue Oct  3 16:25:00 2006
--- gcc-4.2.1-new/gcc/config/sparc/sparc.h      Mon Oct  1 20:05:16 2007
***************
*** 690,695 ****
--- 690,702 ----
     && TYPE_MODE (TREE_TYPE (TYPE)) == QImode  \
     && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))

+ /* Make stack local arrays of chars word-aligned for the same reasons.  */
+ #define LOCAL_ALIGNMENT(TYPE, ALIGN)            \
+   (TREE_CODE (TYPE) == ARRAY_TYPE             \
+    && TYPE_MODE (TREE_TYPE (TYPE)) == QImode  \
+    && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
+ 
+ 
  /* Set this nonzero if move instructions will actually fail to work
     when given unaligned data.  */
  #define STRICT_ALIGNMENT 1


-- 

amruth dot laxman at nsn dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33594

Reply via email to