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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [abi/] [bitfield3.C] - Blame information for rev 801

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

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

powered by: WebSVN 2.1.0

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