diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/g++.dg/abi/bitfield3.C | |
download | cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2 cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/g++.dg/abi/bitfield3.C')
-rw-r--r-- | gcc/testsuite/g++.dg/abi/bitfield3.C | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/abi/bitfield3.C b/gcc/testsuite/g++.dg/abi/bitfield3.C new file mode 100644 index 000000000..b96c9ed8d --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/bitfield3.C @@ -0,0 +1,84 @@ +// Test for oversized bitfield alignment in structs on IA-32 +// { dg-do run { target i?86-*-* x86_64-*-* } } +// { dg-options "-O2" } +// Cygwin and mingw32 default to MASK_ALIGN_DOUBLE. Override to ensure +// 4-byte alignment. +// { dg-options "-mno-align-double" { target i?86-*-cygwin* i?86-*-mingw* } } +// { dg-require-effective-target ilp32 } + +struct A +{ + char a; + int b : 224; // { dg-warning "exceeds its type" "" } + char c; +} a, a4[4]; + +struct B +{ + char d; + A e; + char f; +} b; + +struct C +{ + char g; + long long h : 64; + char i; +} c, c4[4]; + +struct D +{ + char j; + C k; + char l; +} d; + +struct E +{ + char m; + long long n : 160; // { dg-warning "exceeds its type" "" } + char o; +} e, e4[4]; + +struct F +{ + char p; + E q; + char r; +} f; + +int main (void) +{ + if (&a.c - &a.a != 32) + return 1; + if (sizeof (a) != 36) + return 2; + if (sizeof (a4) != 4 * 36) + return 3; + if (sizeof (b) != 2 * 4 + 36) + return 4; + if (__alignof__ (b.e) != 4) + return 5; + if (&c.i - &c.g != 12) + return 6; + if (sizeof (c) != 16) + return 7; + if (sizeof (c4) != 4 * 16) + return 8; + if (sizeof (d) != 2 * 4 + 16) + return 9; + if (__alignof__ (d.k) != 4) + return 10; + if (&e.o - &e.m != 24) + return 11; + if (sizeof (e) != 28) + return 12; + if (sizeof (e4) != 4 * 28) + return 13; + if (sizeof (f) != 2 * 4 + 28) + return 14; + if (__alignof__ (f.q) != 4) + return 15; + return 0; +} |