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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [abi/] [bitfield3.C] - Blame information for rev 154

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

Line No. Rev Author Line
1 149 jeremybenn
// Test for oversized bitfield alignment in structs on IA-32
2
// { dg-do run { target i?86-*-* x86_64-*-* } }
3
// { dg-options "-O2" }
4
// Cygwin and mingw32 default to MASK_ALIGN_DOUBLE. Override to ensure
5
// 4-byte alignment.
6
// { dg-options "-mno-align-double" { target i?86-*-cygwin* i?86-*-mingw* } }
7
// { dg-require-effective-target ilp32 }
8
 
9
struct A
10
{
11
  char a;
12
  int b : 224;  // { dg-warning "exceeds its type" "" }
13
  char c;
14
} a, a4[4];
15
 
16
struct B
17
{
18
  char d;
19
  A e;
20
  char f;
21
} b;
22
 
23
struct C
24
{
25
  char g;
26
  long long h : 64;
27
  char i;
28
} c, c4[4];
29
 
30
struct D
31
{
32
  char j;
33
  C k;
34
  char l;
35
} d;
36
 
37
struct E
38
{
39
  char m;
40
  long long n : 160;    // { dg-warning "exceeds its type" "" }
41
  char o;
42
} e, e4[4];
43
 
44
struct F
45
{
46
  char p;
47
  E q;
48
  char r;
49
} f;
50
 
51
int main (void)
52
{
53
  if (&a.c - &a.a != 32)
54
    return 1;
55
  if (sizeof (a) != 36)
56
    return 2;
57
  if (sizeof (a4) != 4 * 36)
58
    return 3;
59
  if (sizeof (b) != 2 * 4 + 36)
60
    return 4;
61
  if (__alignof__ (b.e) != 4)
62
    return 5;
63
  if (&c.i - &c.g != 12)
64
    return 6;
65
  if (sizeof (c) != 16)
66
    return 7;
67
  if (sizeof (c4) != 4 * 16)
68
    return 8;
69
  if (sizeof (d) != 2 * 4 + 16)
70
    return 9;
71
  if (__alignof__ (d.k) != 4)
72
    return 10;
73
  if (&e.o - &e.m != 24)
74
    return 11;
75
  if (sizeof (e) != 28)
76
    return 12;
77
  if (sizeof (e4) != 4 * 28)
78
    return 13;
79
  if (sizeof (f) != 2 * 4 + 28)
80
    return 14;
81
  if (__alignof__ (f.q) != 4)
82
    return 15;
83
  return 0;
84
}

powered by: WebSVN 2.1.0

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