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]

[patch] Aligned attribute incorrectly applied to a type.


For this test case:

typedef int new_int __attribute__ ((aligned(16)));
int o_int;

the compiler is generating:

        .common o_int,4,16

This patch will cause the correct alignment to be emitted.  This
was bootstrapped on solaris.  Okay to commit?

Thu Jun 29 15:59:32 2000  Catherine Moore  <clm@cygnus.com>

	* c-common.c (decl_attributes):  Differentiate between
	types and type decls for alignment.


Index: c-common.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-common.c,v
retrieving revision 1.121
diff -p -r1.121 c-common.c
*** c-common.c  2000/06/25 17:27:27     1.121
--- c-common.c  2000/06/29 20:59:36
*************** decl_attributes (node, attributes, prefi
*** 780,787 ****
              error ("requested alignment is too large");
            else if (is_type)
              {
!               TYPE_ALIGN (type) = (1 << i) * BITS_PER_UNIT;
!               TYPE_USER_ALIGN (type) = 1;
              }
            else if (TREE_CODE (decl) != VAR_DECL
                     && TREE_CODE (decl) != FIELD_DECL)
--- 780,795 ----
              error ("requested alignment is too large");
            else if (is_type)
              {
!               if (decl)
!                 {
!                   DECL_ALIGN (decl) = (1 << i) * BITS_PER_UNIT;
!                   DECL_USER_ALIGN (decl) = 1;
!                 }
!               else
!                 {
!                   TYPE_ALIGN (type) = (1 << i) * BITS_PER_UNIT;
!                   TYPE_USER_ALIGN (type) = 1;
!                 }
              }
            else if (TREE_CODE (decl) != VAR_DECL
                     && TREE_CODE (decl) != FIELD_DECL)


 testsuite/ChangeLog

Thu Jun 29 15:59:32 2000  Catherine Moore  <clm@cygnus.com>

	* gcc.dg/align-1.c:  New test.

typedef int new_int __attribute__ ((aligned(16)));
int o_int;
/* { dg-final { scan-assembler align-1.c "o_int,4,4" } } */

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