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

A problem with aligment attribute


I am working on adding __float128 I/O support to glibc for ia32 and
ia64. I'd like to use gcc 3.3 for my work. My change doesn't involve
__float128 computation. But I need a way to access a __float128
variable as integers. I noticed that gcc used 16 byte aligment for
__float128 on both ia32 and ia64. I am using

typedef struct
  {
    unsigned long long int word0 __attribute__((__aligned__(16)));
    unsigned long long int word1;
  } float128_type;

to represent __float128 on ia32. The problem is gcc won't align it
to 16 byte. Before I open a bug report, I'd like to verify it is a
bug.



H.J.
--bar.c--
#include <stdlib.h>

typedef struct
  {
    unsigned long long int word0 __attribute__((__aligned__(16)));
    unsigned long long int word1;
  } float128_type;
 
void
foo (int i, float128_type x)
{
  if (__alignof (x) != 16)
    abort ();
  if (((long) (&x.word0) & 15) != 0)
    abort ();
}

int
main ()
{
  float128_type x = { 0, 0x3ffe000000000000ULL};

  foo (0, x);
  return 0;
}


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