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]

[PATCH] Fix gcc.dg/pragma-align.c


Hello,

The testcase fails on sparc64-sun-solaris2.* because the following test

struct {
        char one;
        long two;
} defaultalign;

#pragma pack(4)
struct {
        char one;
        long two;
} sixteen;

        if(sizeof(sixteen) < sizeof(defaultalign)) abort();

is wrong.  We have because of the 64-bit ABI:
  sizeof(defaultalign) == 16;
  sizeof(sixteen) == 12;

I propose to use #pragma pack(8) on LP64 targets.  OK for mainline?


2004-11-04 ?Eric Botcazou ?<ebotcazou@libertysurf.fr>

	* gcc.dg/pragma-align.c (sixteen): Use 8-byte alignment
	on LP64 targets.


-- 
Eric Botcazou
Index: gcc.dg/pragma-align.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pragma-align.c,v
retrieving revision 1.4
diff -u -r1.4 pragma-align.c
--- gcc.dg/pragma-align.c	3 Aug 2004 08:22:21 -0000	1.4
+++ gcc.dg/pragma-align.c	4 Nov 2004 11:01:08 -0000
@@ -9,7 +9,11 @@
         long two;
 } defaultalign;
 
+#if defined(__LP64__)
+#pragma pack(8)
+#else
 #pragma pack(4)
+#endif
 struct {
         char one;
         long two;

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