URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 154 |
Rev 816 |
// Test for bitfield alignment in structs on IA-32
|
// Test for bitfield alignment in structs on IA-32
|
// { dg-do run { target i?86-*-* x86_64-*-* } }
|
// { dg-do run { target i?86-*-* x86_64-*-* } }
|
// { dg-require-effective-target ilp32 }
|
// { dg-require-effective-target ilp32 }
|
// { dg-options "-O2" }
|
// { dg-options "-O2" }
|
// { dg-options "-mno-align-double -mno-ms-bitfields" { target i?86-*-interix* i?86-*-cygwin* i?86-*-mingw*} }
|
// { dg-options "-mno-align-double -mno-ms-bitfields" { target i?86-*-interix* i?86-*-cygwin* i?86-*-mingw*} }
|
|
|
extern void abort (void);
|
extern void abort (void);
|
extern void exit (int);
|
extern void exit (int);
|
|
|
struct A
|
struct A
|
{
|
{
|
char a;
|
char a;
|
long long b : 61;
|
long long b : 61;
|
char c;
|
char c;
|
} a, a4[4];
|
} a, a4[4];
|
|
|
struct B
|
struct B
|
{
|
{
|
char d;
|
char d;
|
struct A e;
|
struct A e;
|
char f;
|
char f;
|
} b;
|
} b;
|
|
|
struct C
|
struct C
|
{
|
{
|
char g;
|
char g;
|
union U
|
union U
|
{
|
{
|
char u1;
|
char u1;
|
long long u2;
|
long long u2;
|
long long u3 : 64;
|
long long u3 : 64;
|
} h;
|
} h;
|
char i;
|
char i;
|
} c;
|
} c;
|
|
|
int main (void)
|
int main (void)
|
{
|
{
|
if (&a.c - &a.a != 12)
|
if (&a.c - &a.a != 12)
|
abort ();
|
abort ();
|
if (sizeof (a) != 16)
|
if (sizeof (a) != 16)
|
abort ();
|
abort ();
|
if (sizeof (a4) != 4 * 16)
|
if (sizeof (a4) != 4 * 16)
|
abort ();
|
abort ();
|
if (sizeof (b) != 2 * 4 + 16)
|
if (sizeof (b) != 2 * 4 + 16)
|
abort ();
|
abort ();
|
if (__alignof__ (b.e) != 4)
|
if (__alignof__ (b.e) != 4)
|
abort ();
|
abort ();
|
if (&c.i - &c.g != 12)
|
if (&c.i - &c.g != 12)
|
abort ();
|
abort ();
|
if (sizeof (c) != 16)
|
if (sizeof (c) != 16)
|
abort ();
|
abort ();
|
if (__alignof__ (c.h) != 4)
|
if (__alignof__ (c.h) != 4)
|
abort ();
|
abort ();
|
exit (0);
|
exit (0);
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.