diff options
author | Mark Mitchell <mmitchel@gcc.gnu.org> | 2003-02-18 19:17:28 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2003-02-18 19:17:28 +0000 |
commit | 2e120205b3fef4037f776cdeb3159365be01e300 (patch) | |
tree | 6d0eb0418fa51b34fa362035b64ec13253b4a40f /gcc | |
parent | 30db8e17e58e96a3bad150c42f1e6b11be4585cb (diff) | |
download | gcc-2e120205b3fef4037f776cdeb3159365be01e300.zip gcc-2e120205b3fef4037f776cdeb3159365be01e300.tar.gz gcc-2e120205b3fef4037f776cdeb3159365be01e300.tar.bz2 |
re PR c++/9704 (miscompilation of classes with bit fields)
PR c++/9704
* class.c (layout_class_type): In the 3.2 ABI, take into account
trailing bit fields when computing CLASSTYPE_SIZE_UNIT.
PR c++/9704
* g++.dg/init/copy5.C: New test.
[[Split portion of a mixed commit.]]
From-SVN: r63054.2
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/g++.dg/init/copy5.C | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/init/copy5.C b/gcc/testsuite/g++.dg/init/copy5.C new file mode 100644 index 0000000..cef5a29 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/copy5.C @@ -0,0 +1,29 @@ +// { dg-options "-O2" } + +struct BOOL { + int nVal:1, bSet:1; + BOOL (int i) : nVal(i!=0), bSet(1) {} +}; +struct Fill { + void *d; + Fill() : d(0) {} + Fill( const Fill& ) {} +}; +struct SvMetaSlot { + Fill aGroupId; + BOOL a8; + SvMetaSlot() : + a8(1) {} + SvMetaSlot* MakeClone() const; +}; + +SvMetaSlot* SvMetaSlot::MakeClone() const { return new SvMetaSlot( *this ); } + +extern "C" void abort(void); +int main() +{ + SvMetaSlot s; SvMetaSlot s2(s); + if (s.a8.bSet != s2.a8.bSet) + abort (); + return 0; +} |