This is the mail archive of the 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]

PowerPC64 alignment of long doubles

The PowerPC64 Linux ABI says "The required alignment of a double or long
double field is word, not doubleword or quadword as might be expected
from the size of the field."

and also

"Note: When compared to the 32-bit PowerPC Processor Supplement, the
size and alignment of long has changed, and the alignment of double
and long double has changed.  A compiler may provide options to use
different sizes and alignments; however, any object compiled with
those options will not conform to the 64-bit PowerPC Processor

We currently have this wrong for long double, and I'll shortly be
sending a patch to correct the situation.  Meanwhile, the following
fixes the testsuite to pass with both current and corrected alignment
of long doubles.

	* gcc.dg/ppc-ldstruct.c: Use -malign-natural on powerpc64*-*-*.

OK mainline?  To make this change on the 3.3 branch, I'd also need to
backport -malign-natural support.

Index: gcc/testsuite/gcc.dg/ppc-ldstruct.c
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/ppc-ldstruct.c,v
retrieving revision 1.1
diff -u -p -r1.1 ppc-ldstruct.c
--- gcc/testsuite/gcc.dg/ppc-ldstruct.c	9 Mar 2002 19:14:15 -0000	1.1
+++ gcc/testsuite/gcc.dg/ppc-ldstruct.c	16 Sep 2003 02:31:29 -0000
@@ -1,8 +1,10 @@
 /* { dg-do run { target powerpc*-*-eabi* powerpc*-*-elf* powerpc*-*-linux* } } */
 /* { dg-options "-O -mlong-double-128" } */
+/* { dg-options "-malign-natural" { target powerpc64*-*-* } } */
 /* SVR4 and EABI both specify that 'long double' is aligned to a 128-bit
-   boundary in structures.  */
+   boundary in structures.  However, this is not true for powerpc64-linux
+   where long doubles are aligned to a word boundary.  */
 struct {
   int x;

Alan Modra
IBM OzLabs - Linux Technology Centre

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