OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.target/] [i386/] [bitfield1.c] - Blame information for rev 844

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
// Test for bitfield alignment in structs on IA-32
2
// { dg-do run { target i?86-*-* x86_64-*-* } }
3
// { dg-require-effective-target ilp32 }
4
// { dg-options "-O2" }
5
// { dg-options "-mno-align-double -mno-ms-bitfields" { target i?86-*-interix* i?86-*-cygwin* i?86-*-mingw*} }
6
 
7
extern void abort (void);
8
extern void exit (int);
9
 
10
struct A
11
{
12
  char a;
13
  long long b : 61;
14
  char c;
15
} a, a4[4];
16
 
17
struct B
18
{
19
  char d;
20
  struct A e;
21
  char f;
22
} b;
23
 
24
struct C
25
{
26
  char g;
27
  union U
28
  {
29
    char u1;
30
    long long u2;
31
    long long u3 : 64;
32
  } h;
33
  char i;
34
} c;
35
 
36
int main (void)
37
{
38
  if (&a.c - &a.a != 12)
39
    abort ();
40
  if (sizeof (a) != 16)
41
    abort ();
42
  if (sizeof (a4) != 4 * 16)
43
    abort ();
44
  if (sizeof (b) != 2 * 4 + 16)
45
    abort ();
46
  if (__alignof__ (b.e) != 4)
47
    abort ();
48
  if (&c.i - &c.g != 12)
49
    abort ();
50
  if (sizeof (c) != 16)
51
    abort ();
52
  if (__alignof__ (c.h) != 4)
53
    abort ();
54
  exit (0);
55
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.