From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; 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. --- gcc/testsuite/g++.dg/abi/bitfield3.C | 84 ++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 gcc/testsuite/g++.dg/abi/bitfield3.C (limited to 'gcc/testsuite/g++.dg/abi/bitfield3.C') 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; +} -- cgit v1.2.3