summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjanis <janis@138bc75d-0d04-0410-961f-82ee72b054a4>2002-10-18 00:22:58 +0000
committerjanis <janis@138bc75d-0d04-0410-961f-82ee72b054a4>2002-10-18 00:22:58 +0000
commita22c581bb50a3bd05cf583ae227ae80dd50ba2b6 (patch)
treeda6b04741aa409eb1dceee4f2ad3003d6c8d1007
parent9745a09461a73f315caf10ec1dae3f3a265d51a6 (diff)
downloadgcc-a22c581bb50a3bd05cf583ae227ae80dd50ba2b6.tar.gz
2002-10-17 Janis Johnson <janis187@us.ibm.com>
* g++.dg/README: Describe new compat directory. * g++.dg/dg.exp: Skip tests in compat directory. * README.compat: New file. * lib/compat.exp: New expect script. * g++.dg/compat: New test directory. * g++.dg/compat/compat.exp: New expect script. * g++.dg/compat/abi: New test directory. * g++.dg/compat/abi/bitfield1_x.C, g++.dg/compat/abi/bitfield1_main.C, g++.dg/compat/abi/bitfield1_y.C, g++.dg/compat/abi/bitfield1.h, g++.dg/compat/abi/bitfield2_x.C, g++.dg/compat/abi/bitfield2_main.C, g++.dg/compat/abi/bitfield2_y.C, g++.dg/compat/abi/bitfield2.h, g++.dg/compat/abi/vbase8-10_x.C, g++.dg/compat/abi/vbase8-10_main.C, g++.dg/compat/abi/vbase8-10_y.C, g++.dg/compat/abi/vbase8-10.h, g++.dg/compat/abi/vbase8-21_x.C, g++.dg/compat/abi/vbase8-21_main.C, g++.dg/compat/abi/vbase8-21_y.C, g++.dg/compat/abi/vbase8-21.h, g++.dg/compat/abi/vbase8-22_x.C, g++.dg/compat/abi/vbase8-22_main.C, g++.dg/compat/abi/vbase8-22_y.C, g++.dg/compat/abi/vbase8-22.h, g++.dg/compat/abi/vbase8-4_x.C, g++.dg/compat/abi/vbase8-4_main.C, g++.dg/compat/abi/vbase8-4_y.C, g++.dg/compat/abi/vbase8-4.h: New files. * g++.dg/compat/break: New test directory. * g++.dg/compat/break/empty6_x.C, g++.dg/compat/break/empty6_main.C, g++.dg/compat/break/empty6_y.C, g++.dg/compat/break/empty6.h, g++.dg/compat/break/vbase10_x.C, g++.dg/compat/break/vbase10_main.C, g++.dg/compat/break/vbase10_y.C, g++.dg/compat/break/vbase10.h, g++.dg/compat/break/vbase11_x.C, g++.dg/compat/break/vbase11_main.C, g++.dg/compat/break/vbase11_y.C, g++.dg/compat/break/vbase11.h, g++.dg/compat/break/bitfield7_x.C, g++.dg/compat/break/bitfield7_main.C, g++.dg/compat/break/bitfield7_y.C, g++.dg/compat/break/bitfield7.h, g++.dg/compat/break/bitfield5_x.C, g++.dg/compat/break/bitfield5_main.C, g++.dg/compat/break/bitfield5_y.C, g++.dg/compat/break/bitfield5.h, g++.dg/compat/break/README: New files. * g++.dg/compat/eh: New test directory. * g++.dg/compat/eh/ctor1_x.C, g++.dg/compat/eh/ctor1_main.C, g++.dg/compat/eh/ctor1_y.C, g++.dg/compat/eh/ctor1.h, g++.dg/compat/eh/ctor2_x.C, g++.dg/compat/eh/ctor2_main.C, g++.dg/compat/eh/ctor2_y.C, g++.dg/compat/eh/ctor2.h, g++.dg/compat/eh/dtor1_x.C, g++.dg/compat/eh/dtor1_main.C, g++.dg/compat/eh/dtor1_y.C, g++.dg/compat/eh/dtor1.h, g++.dg/compat/eh/filter1_x.C, g++.dg/compat/eh/filter1_main.C, g++.dg/compat/eh/filter1_y.C, g++.dg/compat/eh/filter1.h, g++.dg/compat/eh/filter2_x.C, g++.dg/compat/eh/filter2_main.C, g++.dg/compat/eh/filter2_y.C, g++.dg/compat/eh/new1_x.C, g++.dg/compat/eh/new1_main.C, g++.dg/compat/eh/new1_y.C, g++.dg/compat/eh/nrv1_x.C, g++.dg/compat/eh/nrv1_main.C, g++.dg/compat/eh/nrv1_y.C, g++.dg/compat/eh/nrv1.h, g++.dg/compat/eh/spec3_x.C, g++.dg/compat/eh/spec3_main.C, g++.dg/compat/eh/spec3_y.C, g++.dg/compat/eh/spec3.h, g++.dg/compat/eh/template1_x.C, g++.dg/compat/eh/template1_main.C, g++.dg/compat/eh/template1_y.C, g++.dg/compat/eh/template1.h, g++.dg/compat/eh/unexpected1_x.C, g++.dg/compat/eh/unexpected1_main.C, g++.dg/compat/eh/unexpected1_y.C: New files. * g++.dg/compat/init: New test directory. * g++.dg/compat/init/array5_x.C, g++.dg/compat/init/array5_main.C, g++.dg/compat/init/array5_y.C, g++.dg/compat/init/byval1_x.C, g++.dg/compat/init/byval1_main.C, g++.dg/compat/init/byval1_y.C, g++.dg/compat/init/byval1.h, g++.dg/compat/init/dtor1_x.C, g++.dg/compat/init/dtor1_main.C, g++.dg/compat/init/dtor1_y.C, g++.dg/compat/init/dtor1.h, g++.dg/compat/init/elide1_x.C, g++.dg/compat/init/elide1_main.C, g++.dg/compat/init/elide1_y.C, g++.dg/compat/init/elide1.h, g++.dg/compat/init/init-ref2_x.C, g++.dg/compat/init/init-ref2_main.C, g++.dg/compat/init/init-ref2_y.C: New files. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@58266 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/testsuite/ChangeLog66
-rw-r--r--gcc/testsuite/README.compat72
-rw-r--r--gcc/testsuite/g++.dg/README1
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/bitfield1.h10
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/bitfield1_main.C13
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/bitfield1_x.C14
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/bitfield1_y.C13
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/bitfield2.h10
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/bitfield2_main.C13
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/bitfield2_x.C14
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/bitfield2_y.C13
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/vbase8-10.h54
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/vbase8-10_main.C16
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/vbase8-10_x.C49
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/vbase8-10_y.C63
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/vbase8-21.h54
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/vbase8-21_main.C16
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/vbase8-21_x.C49
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/vbase8-21_y.C63
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/vbase8-22.h59
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/vbase8-22_main.C16
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/vbase8-22_x.C49
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/vbase8-22_y.C63
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/vbase8-4.h57
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/vbase8-4_main.C16
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/vbase8-4_x.C49
-rw-r--r--gcc/testsuite/g++.dg/compat/abi/vbase8-4_y.C63
-rw-r--r--gcc/testsuite/g++.dg/compat/break/README11
-rw-r--r--gcc/testsuite/g++.dg/compat/break/bitfield5.h11
-rw-r--r--gcc/testsuite/g++.dg/compat/break/bitfield5_main.C14
-rw-r--r--gcc/testsuite/g++.dg/compat/break/bitfield5_x.C13
-rw-r--r--gcc/testsuite/g++.dg/compat/break/bitfield5_y.C13
-rw-r--r--gcc/testsuite/g++.dg/compat/break/bitfield7.h3
-rw-r--r--gcc/testsuite/g++.dg/compat/break/bitfield7_main.C16
-rw-r--r--gcc/testsuite/g++.dg/compat/break/bitfield7_x.C13
-rw-r--r--gcc/testsuite/g++.dg/compat/break/bitfield7_y.C11
-rw-r--r--gcc/testsuite/g++.dg/compat/break/empty6.h7
-rw-r--r--gcc/testsuite/g++.dg/compat/break/empty6_main.C14
-rw-r--r--gcc/testsuite/g++.dg/compat/break/empty6_x.C12
-rw-r--r--gcc/testsuite/g++.dg/compat/break/empty6_y.C9
-rw-r--r--gcc/testsuite/g++.dg/compat/break/vbase10.h12
-rw-r--r--gcc/testsuite/g++.dg/compat/break/vbase10_main.C14
-rw-r--r--gcc/testsuite/g++.dg/compat/break/vbase10_x.C13
-rw-r--r--gcc/testsuite/g++.dg/compat/break/vbase10_y.C14
-rw-r--r--gcc/testsuite/g++.dg/compat/break/vbase11.h12
-rw-r--r--gcc/testsuite/g++.dg/compat/break/vbase11_main.C13
-rw-r--r--gcc/testsuite/g++.dg/compat/break/vbase11_x.C14
-rw-r--r--gcc/testsuite/g++.dg/compat/break/vbase11_y.C11
-rw-r--r--gcc/testsuite/g++.dg/compat/compat.exp137
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/ctor1.h10
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/ctor1_main.C13
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/ctor1_x.C22
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/ctor1_y.C13
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/ctor2.h22
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/ctor2_main.C12
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/ctor2_x.C19
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/ctor2_y.C20
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/dtor1.h7
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/dtor1_main.C14
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/dtor1_x.C14
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/dtor1_y.C18
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/filter1.h5
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/filter1_main.C11
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/filter1_x.C21
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/filter1_y.C17
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/filter2_main.C12
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/filter2_x.C20
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/filter2_y.C39
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/new1_main.C13
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/new1_x.C28
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/new1_y.C18
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/nrv1.h5
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/nrv1_main.C12
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/nrv1_x.C21
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/nrv1_y.C8
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/spec3.h8
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/spec3_main.C12
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/spec3_x.C9
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/spec3_y.C8
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/template1.h15
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/template1_main.C12
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/template1_x.C21
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/template1_y.C8
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/unexpected1_main.C12
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/unexpected1_x.C26
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/unexpected1_y.C21
-rw-r--r--gcc/testsuite/g++.dg/compat/init/array5_main.C14
-rw-r--r--gcc/testsuite/g++.dg/compat/init/array5_x.C33
-rw-r--r--gcc/testsuite/g++.dg/compat/init/array5_y.C20
-rw-r--r--gcc/testsuite/g++.dg/compat/init/byval1.h6
-rw-r--r--gcc/testsuite/g++.dg/compat/init/byval1_main.C12
-rw-r--r--gcc/testsuite/g++.dg/compat/init/byval1_x.C15
-rw-r--r--gcc/testsuite/g++.dg/compat/init/byval1_y.C14
-rw-r--r--gcc/testsuite/g++.dg/compat/init/dtor1.h30
-rw-r--r--gcc/testsuite/g++.dg/compat/init/dtor1_main.C9
-rw-r--r--gcc/testsuite/g++.dg/compat/init/dtor1_x.C7
-rw-r--r--gcc/testsuite/g++.dg/compat/init/dtor1_y.C18
-rw-r--r--gcc/testsuite/g++.dg/compat/init/elide1.h5
-rw-r--r--gcc/testsuite/g++.dg/compat/init/elide1_main.C25
-rw-r--r--gcc/testsuite/g++.dg/compat/init/elide1_x.C15
-rw-r--r--gcc/testsuite/g++.dg/compat/init/elide1_y.C9
-rw-r--r--gcc/testsuite/g++.dg/compat/init/init-ref2_main.C11
-rw-r--r--gcc/testsuite/g++.dg/compat/init/init-ref2_x.C22
-rw-r--r--gcc/testsuite/g++.dg/compat/init/init-ref2_y.C24
-rw-r--r--gcc/testsuite/g++.dg/dg.exp1
-rw-r--r--gcc/testsuite/lib/compat.exp232
106 files changed, 2450 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 89befc5692b..f718424a935 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,69 @@
+2002-10-17 Janis Johnson <janis187@us.ibm.com>
+
+ * g++.dg/README: Describe new compat directory.
+ * g++.dg/dg.exp: Skip tests in compat directory.
+ * README.compat: New file.
+ * lib/compat.exp: New expect script.
+ * g++.dg/compat: New test directory.
+ * g++.dg/compat/compat.exp: New expect script.
+ * g++.dg/compat/abi: New test directory.
+ * g++.dg/compat/abi/bitfield1_x.C, g++.dg/compat/abi/bitfield1_main.C,
+ g++.dg/compat/abi/bitfield1_y.C, g++.dg/compat/abi/bitfield1.h,
+ g++.dg/compat/abi/bitfield2_x.C, g++.dg/compat/abi/bitfield2_main.C,
+ g++.dg/compat/abi/bitfield2_y.C, g++.dg/compat/abi/bitfield2.h,
+ g++.dg/compat/abi/vbase8-10_x.C, g++.dg/compat/abi/vbase8-10_main.C,
+ g++.dg/compat/abi/vbase8-10_y.C, g++.dg/compat/abi/vbase8-10.h,
+ g++.dg/compat/abi/vbase8-21_x.C, g++.dg/compat/abi/vbase8-21_main.C,
+ g++.dg/compat/abi/vbase8-21_y.C, g++.dg/compat/abi/vbase8-21.h,
+ g++.dg/compat/abi/vbase8-22_x.C, g++.dg/compat/abi/vbase8-22_main.C,
+ g++.dg/compat/abi/vbase8-22_y.C, g++.dg/compat/abi/vbase8-22.h,
+ g++.dg/compat/abi/vbase8-4_x.C, g++.dg/compat/abi/vbase8-4_main.C,
+ g++.dg/compat/abi/vbase8-4_y.C, g++.dg/compat/abi/vbase8-4.h: New files.
+ * g++.dg/compat/break: New test directory.
+ * g++.dg/compat/break/empty6_x.C, g++.dg/compat/break/empty6_main.C,
+ g++.dg/compat/break/empty6_y.C, g++.dg/compat/break/empty6.h,
+ g++.dg/compat/break/vbase10_x.C, g++.dg/compat/break/vbase10_main.C,
+ g++.dg/compat/break/vbase10_y.C, g++.dg/compat/break/vbase10.h,
+ g++.dg/compat/break/vbase11_x.C, g++.dg/compat/break/vbase11_main.C,
+ g++.dg/compat/break/vbase11_y.C, g++.dg/compat/break/vbase11.h,
+ g++.dg/compat/break/bitfield7_x.C, g++.dg/compat/break/bitfield7_main.C,
+ g++.dg/compat/break/bitfield7_y.C, g++.dg/compat/break/bitfield7.h,
+ g++.dg/compat/break/bitfield5_x.C, g++.dg/compat/break/bitfield5_main.C,
+ g++.dg/compat/break/bitfield5_y.C, g++.dg/compat/break/bitfield5.h,
+ g++.dg/compat/break/README: New files.
+ * g++.dg/compat/eh: New test directory.
+ * g++.dg/compat/eh/ctor1_x.C, g++.dg/compat/eh/ctor1_main.C,
+ g++.dg/compat/eh/ctor1_y.C, g++.dg/compat/eh/ctor1.h,
+ g++.dg/compat/eh/ctor2_x.C, g++.dg/compat/eh/ctor2_main.C,
+ g++.dg/compat/eh/ctor2_y.C, g++.dg/compat/eh/ctor2.h,
+ g++.dg/compat/eh/dtor1_x.C, g++.dg/compat/eh/dtor1_main.C,
+ g++.dg/compat/eh/dtor1_y.C, g++.dg/compat/eh/dtor1.h,
+ g++.dg/compat/eh/filter1_x.C, g++.dg/compat/eh/filter1_main.C,
+ g++.dg/compat/eh/filter1_y.C, g++.dg/compat/eh/filter1.h,
+ g++.dg/compat/eh/filter2_x.C, g++.dg/compat/eh/filter2_main.C,
+ g++.dg/compat/eh/filter2_y.C,
+ g++.dg/compat/eh/new1_x.C, g++.dg/compat/eh/new1_main.C,
+ g++.dg/compat/eh/new1_y.C,
+ g++.dg/compat/eh/nrv1_x.C, g++.dg/compat/eh/nrv1_main.C,
+ g++.dg/compat/eh/nrv1_y.C, g++.dg/compat/eh/nrv1.h,
+ g++.dg/compat/eh/spec3_x.C, g++.dg/compat/eh/spec3_main.C,
+ g++.dg/compat/eh/spec3_y.C, g++.dg/compat/eh/spec3.h,
+ g++.dg/compat/eh/template1_x.C, g++.dg/compat/eh/template1_main.C,
+ g++.dg/compat/eh/template1_y.C, g++.dg/compat/eh/template1.h,
+ g++.dg/compat/eh/unexpected1_x.C, g++.dg/compat/eh/unexpected1_main.C,
+ g++.dg/compat/eh/unexpected1_y.C: New files.
+ * g++.dg/compat/init: New test directory.
+ * g++.dg/compat/init/array5_x.C, g++.dg/compat/init/array5_main.C,
+ g++.dg/compat/init/array5_y.C,
+ g++.dg/compat/init/byval1_x.C, g++.dg/compat/init/byval1_main.C,
+ g++.dg/compat/init/byval1_y.C, g++.dg/compat/init/byval1.h,
+ g++.dg/compat/init/dtor1_x.C, g++.dg/compat/init/dtor1_main.C,
+ g++.dg/compat/init/dtor1_y.C, g++.dg/compat/init/dtor1.h,
+ g++.dg/compat/init/elide1_x.C, g++.dg/compat/init/elide1_main.C,
+ g++.dg/compat/init/elide1_y.C, g++.dg/compat/init/elide1.h,
+ g++.dg/compat/init/init-ref2_x.C, g++.dg/compat/init/init-ref2_main.C,
+ g++.dg/compat/init/init-ref2_y.C: New files.
+
2002-10-17 Mark Mitchell <mark@codesourcery.com>
PR c++/7584
diff --git a/gcc/testsuite/README.compat b/gcc/testsuite/README.compat
new file mode 100644
index 00000000000..da2340a9050
--- /dev/null
+++ b/gcc/testsuite/README.compat
@@ -0,0 +1,72 @@
+Compatibility test suites that use lib/compat.exp test interoperability
+of two compilers that follow the same ABI, or of multiple sets of
+compiler options that are not intended to affect binary compatibility.
+They do not test conformance to a formal ABI; they check that things are
+done consistently, not that they are done correctly. They are meant to
+complement ABI test suites, not to replace them.
+
+Each test in these suites splits up functionality into two source files
+that can be compiled with two different versions of GCC and with two
+sets of compiler options.
+
+ Override the default pairs of compiler options (from compat.exp) by
+ defining the environment variable COMPAT_OPTIONS as:
+ COMPAT_OPTIONS="[list [list {tst1} {alt1}]...[list {tstn} {altn}]]"
+ where tsti and alti are lists of options, with "tsti" used by the
+ compiler under test and "alti" used by the alternate compiler. The
+ characters "[", "{", "}", and "]" are really in the string, as in
+ "[list [list {-g} {-O3}] [list {-O3} {-g}]]".
+
+ To use an alternate compiler, define the environment variable for the
+ language you're testing; e.g., for C++ define ALT_CXX_UNDER_TEST to be
+ the full pathname of an installed compiler. That will be written to
+ the site.exp file used by DejaGNU. The default is to build each test
+ with the compiler under test using the first of each pair of compiler
+ options from COMPAT_OPTIONS. When ALT_CXX_UNDER_TEST is "same", each
+ test is built using the compiler under test but with combinations of
+ the options from COMPAT_OPTIONS.
+
+A test that fails when the pieces are compiled with different compilers
+but passes when the pieces are compiled with the same compiler
+demonstrates incompatibility of the generated code or runtime support.
+A test that fails for the alternate compiler but passes for the compiler
+under test probably tests for a fix that is not present in the alternate
+compiler.
+
+There's a lot more that can be done with these tests.
+
+ Increase the robustness of the existing tests:
+
+ - recognize target triples in dg-options strings in test files
+
+ - continue to split up tests that rely on language runtime support
+ and add them to this set of tests
+
+ - make sure they work for testing with a simulator
+
+ - multilibs support?
+
+ Build test pieces into more combinations that will be likely to find
+ unusual errors:
+
+ - link using the alternate compiler; this requires support for
+ LD_LIBRARY_PATH for the alternate compiler in the support for each
+ language
+
+ - build pieces of the test into shared libraries; this requires
+ support for LD_LIBRARY_PATH for the alternate compiler, and
+ knowledge about how to build a shared library for each target
+
+ - build pieces of the test into static libraries; this requires
+ knowledge about how to build a static library for each target
+
+ Continue to add tests to g++.dg/compat, based on existing tests for
+ language runtime support and for test cases in PRs that didn't used to
+ fit into the test suite.
+
+ Set up similar tests in libstdc++-v3/testsuite.
+
+ Set up similar tests for additional languages and libraries.
+
+Janis Johnson, <janis187@us.ibm.com>
+October 2002
diff --git a/gcc/testsuite/g++.dg/README b/gcc/testsuite/g++.dg/README
index b2a36fdf969..07e7572a71d 100644
--- a/gcc/testsuite/g++.dg/README
+++ b/gcc/testsuite/g++.dg/README
@@ -1,6 +1,7 @@
Subdirectories:
abi Tests for ABI compatibility -- mangling, object layout, etc.
+compat Tests for binary compatibility (consistency, not ABI conformance)
cpp Tests for the preprocessor.
eh Tests for exception handling.
expr Tests for expressions.
diff --git a/gcc/testsuite/g++.dg/compat/abi/bitfield1.h b/gcc/testsuite/g++.dg/compat/abi/bitfield1.h
new file mode 100644
index 00000000000..09d64162ff3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/bitfield1.h
@@ -0,0 +1,10 @@
+typedef int Int;
+typedef signed int SInt;
+typedef unsigned int UInt;
+
+struct A
+{
+ SInt bitS : 1; // signed
+ UInt bitU : 1; // unsigned
+ Int bit : 1; // signedness by -f{signed,unsigned}-bitfields
+};
diff --git a/gcc/testsuite/g++.dg/compat/abi/bitfield1_main.C b/gcc/testsuite/g++.dg/compat/abi/bitfield1_main.C
new file mode 100644
index 00000000000..cdb7a45a744
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/bitfield1_main.C
@@ -0,0 +1,13 @@
+// { dg-options "-ansi -pedantic-errors -funsigned-bitfields" }
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 15 Dec 2001 <nathan@codesourcery.com>
+// Split into pieces for binary compatibility testing October 2002
+
+extern void bitfield1_x (void);
+
+int
+main ()
+{
+ bitfield1_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/abi/bitfield1_x.C b/gcc/testsuite/g++.dg/compat/abi/bitfield1_x.C
new file mode 100644
index 00000000000..1447655a33e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/bitfield1_x.C
@@ -0,0 +1,14 @@
+#include "bitfield1.h"
+
+extern void bitfield1_y (A& a);
+
+void bitfield1_x ()
+{
+ A a;
+
+ a.bitS = 1;
+ a.bitU = 1;
+ a.bit = 1;
+
+ bitfield1_y (a);
+}
diff --git a/gcc/testsuite/g++.dg/compat/abi/bitfield1_y.C b/gcc/testsuite/g++.dg/compat/abi/bitfield1_y.C
new file mode 100644
index 00000000000..7ca5d4b3f51
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/bitfield1_y.C
@@ -0,0 +1,13 @@
+extern "C" void abort (void);
+
+#include "bitfield1.h"
+
+void bitfield1_y (A& a)
+{
+ if (a.bitS != -1)
+ abort ();
+ if (a.bitU != 1)
+ abort ();
+ if (a.bit != 1)
+ abort ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/abi/bitfield2.h b/gcc/testsuite/g++.dg/compat/abi/bitfield2.h
new file mode 100644
index 00000000000..09d64162ff3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/bitfield2.h
@@ -0,0 +1,10 @@
+typedef int Int;
+typedef signed int SInt;
+typedef unsigned int UInt;
+
+struct A
+{
+ SInt bitS : 1; // signed
+ UInt bitU : 1; // unsigned
+ Int bit : 1; // signedness by -f{signed,unsigned}-bitfields
+};
diff --git a/gcc/testsuite/g++.dg/compat/abi/bitfield2_main.C b/gcc/testsuite/g++.dg/compat/abi/bitfield2_main.C
new file mode 100644
index 00000000000..df74037b66b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/bitfield2_main.C
@@ -0,0 +1,13 @@
+// { dg-options "-ansi -pedantic-errors -fsigned-bitfields" }
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 15 Dec 2001 <nathan@codesourcery.com>
+// Split into pieces for binary compatibility testing October 2002
+
+extern void bitfield1_x (void);
+
+int
+main ()
+{
+ bitfield1_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/abi/bitfield2_x.C b/gcc/testsuite/g++.dg/compat/abi/bitfield2_x.C
new file mode 100644
index 00000000000..1447655a33e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/bitfield2_x.C
@@ -0,0 +1,14 @@
+#include "bitfield1.h"
+
+extern void bitfield1_y (A& a);
+
+void bitfield1_x ()
+{
+ A a;
+
+ a.bitS = 1;
+ a.bitU = 1;
+ a.bit = 1;
+
+ bitfield1_y (a);
+}
diff --git a/gcc/testsuite/g++.dg/compat/abi/bitfield2_y.C b/gcc/testsuite/g++.dg/compat/abi/bitfield2_y.C
new file mode 100644
index 00000000000..6119544db16
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/bitfield2_y.C
@@ -0,0 +1,13 @@
+extern "C" void abort (void);
+
+#include "bitfield1.h"
+
+void bitfield1_y (A& a)
+{
+ if (a.bitS != -1)
+ abort ();
+ if (a.bitU != 1)
+ abort ();
+ if (a.bit != -1)
+ abort ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-10.h b/gcc/testsuite/g++.dg/compat/abi/vbase8-10.h
new file mode 100644
index 00000000000..aee0b6b49a5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-10.h
@@ -0,0 +1,54 @@
+class C0
+{ public: int i0; };
+class C1
+ : public C0
+{ public: int i1; };
+class C2
+ : public C1
+ , virtual public C0
+{ public: int i2; };
+class C3
+ : public C1
+ , public C2
+ , virtual public C0
+{ public: int i3; };
+class C4
+ : virtual public C1
+ , virtual public C0
+ , virtual public C3
+ , public C2
+{ public: int i4; };
+class C5
+ : public C3
+ , virtual public C0
+ , virtual public C2
+{ public: int i5; };
+class C6
+ : public C1
+ , public C2
+ , virtual public C5
+ , virtual public C3
+ , virtual public C0
+{ public: int i6; };
+class C7
+ : public C1
+ , virtual public C5
+ , virtual public C4
+ , virtual public C2
+ , virtual public C0
+ , virtual public C6
+{ public: int i7; };
+class C8
+ : virtual public C4
+ , public C3
+ , public C0
+ , virtual public C7
+ , virtual public C6
+{ public: int i8; };
+class C9
+ : virtual public C0
+ , public C4
+ , public C8
+ , public C1
+ , public C6
+{ public: int i9; };
diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-10_main.C b/gcc/testsuite/g++.dg/compat/abi/vbase8-10_main.C
new file mode 100644
index 00000000000..606c0fe2f93
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-10_main.C
@@ -0,0 +1,16 @@
+// { dg-options -w }
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 26 Jul 2001 <nathan@codesourcery.com>
+// Split into pieces for binary compatibility testing October 2002
+
+// Origin stefan@space.twc.de
+// Bug 3145 case 10. Horribly complicated class hierarchy
+
+extern void vbase8_10_x (void);
+
+int
+main ()
+{
+ vbase8_10_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-10_x.C b/gcc/testsuite/g++.dg/compat/abi/vbase8-10_x.C
new file mode 100644
index 00000000000..18e78fcc59c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-10_x.C
@@ -0,0 +1,49 @@
+#include "vbase8-10.h"
+
+extern void check_C0 (C0&, int);
+extern void check_C1 (C1&, int);
+extern void check_C2 (C2&, int);
+extern void check_C3 (C3&, int);
+extern void check_C4 (C4&, int);
+extern void check_C5 (C5&, int);
+extern void check_C6 (C6&, int);
+extern void check_C7 (C7&, int);
+extern void check_C8 (C8&, int);
+extern void check_C9 (C9&, int);
+
+void
+vbase8_10_x (void)
+{
+ C0 c0;
+ C1 c1;
+ C2 c2;
+ C3 c3;
+ C4 c4;
+ C5 c5;
+ C6 c6;
+ C7 c7;
+ C8 c8;
+ C9 c9;
+
+ c0.i0 = 0;
+ c1.i1 = 101;
+ c2.i2 = 202;
+ c3.i3 = 303;
+ c4.i4 = 404;
+ c5.i5 = 505;
+ c6.i6 = 606;
+ c7.i7 = 707;
+ c8.i8 = 808;
+ c9.i9 = 909;
+
+ check_C0 (c0, 0);
+ check_C1 (c1, 101);
+ check_C2 (c2, 202);
+ check_C3 (c3, 303);
+ check_C4 (c4, 404);
+ check_C5 (c5, 505);
+ check_C6 (c6, 606);
+ check_C7 (c7, 707);
+ check_C8 (c8, 808);
+ check_C9 (c9, 909);
+}
diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-10_y.C b/gcc/testsuite/g++.dg/compat/abi/vbase8-10_y.C
new file mode 100644
index 00000000000..1d6c8261668
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-10_y.C
@@ -0,0 +1,63 @@
+extern "C" void abort (void);
+
+#include "vbase8-10.h"
+
+void check_C0 (C0 &x, int i)
+{
+ if (x.i0 != i)
+ abort ();
+}
+
+void check_C1 (C1 &x, int i)
+{
+ if (x.i1 != i)
+ abort ();
+}
+
+void check_C2 (C2 &x, int i)
+{
+ if (x.i2 != i)
+ abort ();
+}
+
+void check_C3 (C3 &x, int i)
+{
+ if (x.i3 != i)
+ abort ();
+}
+
+void check_C4 (C4 &x, int i)
+{
+ if (x.i4 != i)
+ abort ();
+}
+
+void check_C5 (C5 &x, int i)
+{
+ if (x.i5 != i)
+ abort ();
+}
+
+void check_C6 (C6 &x, int i)
+{
+ if (x.i6 != i)
+ abort ();
+}
+
+void check_C7 (C7 &x, int i)
+{
+ if (x.i7 != i)
+ abort ();
+}
+
+void check_C8 (C8 &x, int i)
+{
+ if (x.i8 != i)
+ abort ();
+}
+
+void check_C9 (C9 &x, int i)
+{
+ if (x.i9 != i)
+ abort ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-21.h b/gcc/testsuite/g++.dg/compat/abi/vbase8-21.h
new file mode 100644
index 00000000000..cd510e2ce85
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-21.h
@@ -0,0 +1,54 @@
+class C0
+{ public: int i0; };
+class C1
+ : virtual public C0
+{ public: int i1; };
+class C2
+ : virtual public C1
+ , virtual public C0
+{ public: int i2; };
+class C3
+ : virtual public C2
+ , virtual public C1
+{ public: int i3; };
+class C4
+ : virtual public C2
+ , public C0
+ , public C1
+{ public: int i4; };
+class C5
+ : virtual public C0
+ , public C2
+ , virtual public C1
+ , virtual public C3
+ , virtual public C4
+{ public: int i5; };
+class C6
+ : virtual public C1
+ , virtual public C3
+ , public C0
+ , public C2
+ , virtual public C4
+{ public: int i6; };
+class C7
+ : virtual public C5
+ , public C2
+ , public C6
+ , virtual public C0
+ , public C3
+{ public: int i7; };
+class C8
+ : virtual public C5
+ , public C7
+ , virtual public C0
+ , virtual public C2
+ , virtual public C6
+{ public: int i8; };
+class C9
+ : virtual public C2
+ , virtual public C4
+ , public C1
+ , virtual public C0
+ , public C7
+ , public C5
+{ public: int i9; };
diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-21_main.C b/gcc/testsuite/g++.dg/compat/abi/vbase8-21_main.C
new file mode 100644
index 00000000000..16a0a3cd3c7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-21_main.C
@@ -0,0 +1,16 @@
+// { dg-options -w }
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 26 Jul 2001 <nathan@codesourcery.com>
+// Split into pieces for binary compatibility testing October 2002
+
+// Origin stefan@space.twc.de
+// Bug 3145 case 10. Horribly complicated class hierarchy
+
+extern void vbase8_21_x (void);
+
+int
+main ()
+{
+ vbase8_21_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-21_x.C b/gcc/testsuite/g++.dg/compat/abi/vbase8-21_x.C
new file mode 100644
index 00000000000..986fcfbe5e4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-21_x.C
@@ -0,0 +1,49 @@
+#include "vbase8-21.h"
+
+extern void check_C0 (C0&, int);
+extern void check_C1 (C1&, int);
+extern void check_C2 (C2&, int);
+extern void check_C3 (C3&, int);
+extern void check_C4 (C4&, int);
+extern void check_C5 (C5&, int);
+extern void check_C6 (C6&, int);
+extern void check_C7 (C7&, int);
+extern void check_C8 (C8&, int);
+extern void check_C9 (C9&, int);
+
+void
+vbase8_21_x (void)
+{
+ C0 c0;
+ C1 c1;
+ C2 c2;
+ C3 c3;
+ C4 c4;
+ C5 c5;
+ C6 c6;
+ C7 c7;
+ C8 c8;
+ C9 c9;
+
+ c0.i0 = 0;
+ c1.i1 = 101;
+ c2.i2 = 202;
+ c3.i3 = 303;
+ c4.i4 = 404;
+ c5.i5 = 505;
+ c6.i6 = 606;
+ c7.i7 = 707;
+ c8.i8 = 808;
+ c9.i9 = 909;
+
+ check_C0 (c0, 0);
+ check_C1 (c1, 101);
+ check_C2 (c2, 202);
+ check_C3 (c3, 303);
+ check_C4 (c4, 404);
+ check_C5 (c5, 505);
+ check_C6 (c6, 606);
+ check_C7 (c7, 707);
+ check_C8 (c8, 808);
+ check_C9 (c9, 909);
+}
diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-21_y.C b/gcc/testsuite/g++.dg/compat/abi/vbase8-21_y.C
new file mode 100644
index 00000000000..0bd76246d4d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-21_y.C
@@ -0,0 +1,63 @@
+extern "C" void abort (void);
+
+#include "vbase8-21.h"
+
+void check_C0 (C0 &x, int i)
+{
+ if (x.i0 != i)
+ abort ();
+}
+
+void check_C1 (C1 &x, int i)
+{
+ if (x.i1 != i)
+ abort ();
+}
+
+void check_C2 (C2 &x, int i)
+{
+ if (x.i2 != i)
+ abort ();
+}
+
+void check_C3 (C3 &x, int i)
+{
+ if (x.i3 != i)
+ abort ();
+}
+
+void check_C4 (C4 &x, int i)
+{
+ if (x.i4 != i)
+ abort ();
+}
+
+void check_C5 (C5 &x, int i)
+{
+ if (x.i5 != i)
+ abort ();
+}
+
+void check_C6 (C6 &x, int i)
+{
+ if (x.i6 != i)
+ abort ();
+}
+
+void check_C7 (C7 &x, int i)
+{
+ if (x.i7 != i)
+ abort ();
+}
+
+void check_C8 (C8 &x, int i)
+{
+ if (x.i8 != i)
+ abort ();
+}
+
+void check_C9 (C9 &x, int i)
+{
+ if (x.i9 != i)
+ abort ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-22.h b/gcc/testsuite/g++.dg/compat/abi/vbase8-22.h
new file mode 100644
index 00000000000..e19e93eaead
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-22.h
@@ -0,0 +1,59 @@
+class C0
+{ public: int i0; };
+class C1
+ : public C0
+{ public: int i1; };
+class C2
+ : public C1
+ , virtual public C0
+{ public: int i2; };
+class C3
+ : virtual public C0
+ , virtual public C2
+ , virtual public C1
+{ public: int i3; };
+class C4
+ : virtual public C2
+ , public C1
+ , virtual public C3
+ , public C0
+{ public: int i4; };
+class C5
+ : virtual public C0
+ , virtual public C4
+ , public C1
+ , virtual public C2
+ , virtual public C3
+{ public: int i5; };
+class C6
+ : public C0
+ , virtual public C1
+ , public C5
+ , public C2
+ , virtual public C3
+ , virtual public C4
+{ public: int i6; };
+class C7
+ : virtual public C1
+ , public C5
+ , virtual public C6
+ , virtual public C4
+ , virtual public C3
+ , virtual public C0
+{ public: int i7; };
+class C8
+ : virtual public C6
+ , virtual public C1
+ , virtual public C2
+ , public C3
+ , virtual public C4
+{ public: int i8; };
+class C9
+ : public C4
+ , virtual public C2
+ , virtual public C8
+ , public C3
+ , public C1
+ , public C6
+ , public C5
+{ public: int i9; };
diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-22_main.C b/gcc/testsuite/g++.dg/compat/abi/vbase8-22_main.C
new file mode 100644
index 00000000000..6455a2efcb9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-22_main.C
@@ -0,0 +1,16 @@
+// { dg-options -w }
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 20 Nov 2001 <nathan@codesourcery.com>
+// Split into pieces for binary compatibility testing October 2002
+
+// Origin stefan@space.twc.de
+// Bug 3145 case 22. Horribly complicated class hierarchy
+
+extern void vbase8_22_x (void);
+
+int
+main ()
+{
+ vbase8_22_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-22_x.C b/gcc/testsuite/g++.dg/compat/abi/vbase8-22_x.C
new file mode 100644
index 00000000000..5d3eacf7c90
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-22_x.C
@@ -0,0 +1,49 @@
+#include "vbase8-22.h"
+
+extern void check_C0 (C0&, int);
+extern void check_C1 (C1&, int);
+extern void check_C2 (C2&, int);
+extern void check_C3 (C3&, int);
+extern void check_C4 (C4&, int);
+extern void check_C5 (C5&, int);
+extern void check_C6 (C6&, int);
+extern void check_C7 (C7&, int);
+extern void check_C8 (C8&, int);
+extern void check_C9 (C9&, int);
+
+void
+vbase8_22_x (void)
+{
+ C0 c0;
+ C1 c1;
+ C2 c2;
+ C3 c3;
+ C4 c4;
+ C5 c5;
+ C6 c6;
+ C7 c7;
+ C8 c8;
+ C9 c9;
+
+ c0.i0 = 0;
+ c1.i1 = 101;
+ c2.i2 = 202;
+ c3.i3 = 303;
+ c4.i4 = 404;
+ c5.i5 = 505;
+ c6.i6 = 606;
+ c7.i7 = 707;
+ c8.i8 = 808;
+ c9.i9 = 909;
+
+ check_C0 (c0, 0);
+ check_C1 (c1, 101);
+ check_C2 (c2, 202);
+ check_C3 (c3, 303);
+ check_C4 (c4, 404);
+ check_C5 (c5, 505);
+ check_C6 (c6, 606);
+ check_C7 (c7, 707);
+ check_C8 (c8, 808);
+ check_C9 (c9, 909);
+}
diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-22_y.C b/gcc/testsuite/g++.dg/compat/abi/vbase8-22_y.C
new file mode 100644
index 00000000000..293ed100be4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-22_y.C
@@ -0,0 +1,63 @@
+extern "C" void abort (void);
+
+#include "vbase8-22.h"
+
+void check_C0 (C0 &x, int i)
+{
+ if (x.i0 != i)
+ abort ();
+}
+
+void check_C1 (C1 &x, int i)
+{
+ if (x.i1 != i)
+ abort ();
+}
+
+void check_C2 (C2 &x, int i)
+{
+ if (x.i2 != i)
+ abort ();
+}
+
+void check_C3 (C3 &x, int i)
+{
+ if (x.i3 != i)
+ abort ();
+}
+
+void check_C4 (C4 &x, int i)
+{
+ if (x.i4 != i)
+ abort ();
+}
+
+void check_C5 (C5 &x, int i)
+{
+ if (x.i5 != i)
+ abort ();
+}
+
+void check_C6 (C6 &x, int i)
+{
+ if (x.i6 != i)
+ abort ();
+}
+
+void check_C7 (C7 &x, int i)
+{
+ if (x.i7 != i)
+ abort ();
+}
+
+void check_C8 (C8 &x, int i)
+{
+ if (x.i8 != i)
+ abort ();
+}
+
+void check_C9 (C9 &x, int i)
+{
+ if (x.i9 != i)
+ abort ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-4.h b/gcc/testsuite/g++.dg/compat/abi/vbase8-4.h
new file mode 100644
index 00000000000..b183fbe4f9b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-4.h
@@ -0,0 +1,57 @@
+class C0
+{ public: int i0; };
+class C1
+ : virtual public C0
+{ public: int i1; };
+class C2
+ : public C0
+ , public C1
+{ public: int i2; };
+class C3
+ : virtual public C0
+ , public C1
+ , public C2
+{ public: int i3; };
+class C4
+ : public C2
+ , public C3
+ , virtual public C1
+ , virtual public C0
+{ public: int i4; };
+class C5
+ : virtual public C2
+ , public C1
+ , public C0
+{ public: int i5; };
+class C6
+ : virtual public C0
+ , virtual public C5
+ , public C1
+ , public C3
+ , public C4
+{ public: int i6; };
+class C7
+ : public C6
+ , virtual public C0
+ , public C1
+ , public C2
+ , virtual public C4
+{ public: int i7; };
+class C8
+ : public C2
+ , virtual public C6
+ , virtual public C7
+ , public C5
+ , public C3
+ , virtual public C4
+{ public: int i8; };
+class C9
+ : public C5
+ , virtual public C3
+ , virtual public C8
+ , public C0
+ , public C2
+ , public C7
+ , public C6
+ , public C4
+{ public: int i9; };
diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-4_main.C b/gcc/testsuite/g++.dg/compat/abi/vbase8-4_main.C
new file mode 100644
index 00000000000..f5e5e38247e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-4_main.C
@@ -0,0 +1,16 @@
+// { dg-options -w }
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 20 Nov 2001 <nathan@codesourcery.com>
+// Split into pieces for binary compatibility testing October 2002
+
+// Origin stefan@space.twc.de
+// Bug 3145 case 4. Horribly complicated class hierarchy
+
+extern void vbase8_4_x (void);
+
+int
+main ()
+{
+ vbase8_4_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-4_x.C b/gcc/testsuite/g++.dg/compat/abi/vbase8-4_x.C
new file mode 100644
index 00000000000..66b514c1b09
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-4_x.C
@@ -0,0 +1,49 @@
+#include "vbase8-4.h"
+
+extern void check_C0 (C0&, int);
+extern void check_C1 (C1&, int);
+extern void check_C2 (C2&, int);
+extern void check_C3 (C3&, int);
+extern void check_C4 (C4&, int);
+extern void check_C5 (C5&, int);
+extern void check_C6 (C6&, int);
+extern void check_C7 (C7&, int);
+extern void check_C8 (C8&, int);
+extern void check_C9 (C9&, int);
+
+void
+vbase8_4_x (void)
+{
+ C0 c0;
+ C1 c1;
+ C2 c2;
+ C3 c3;
+ C4 c4;
+ C5 c5;
+ C6 c6;
+ C7 c7;
+ C8 c8;
+ C9 c9;
+
+ c0.i0 = 0;
+ c1.i1 = 101;
+ c2.i2 = 202;
+ c3.i3 = 303;
+ c4.i4 = 404;
+ c5.i5 = 505;
+ c6.i6 = 606;
+ c7.i7 = 707;
+ c8.i8 = 808;
+ c9.i9 = 909;
+
+ check_C0 (c0, 0);
+ check_C1 (c1, 101);
+ check_C2 (c2, 202);
+ check_C3 (c3, 303);
+ check_C4 (c4, 404);
+ check_C5 (c5, 505);
+ check_C6 (c6, 606);
+ check_C7 (c7, 707);
+ check_C8 (c8, 808);
+ check_C9 (c9, 909);
+}
diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-4_y.C b/gcc/testsuite/g++.dg/compat/abi/vbase8-4_y.C
new file mode 100644
index 00000000000..86dd40433d8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-4_y.C
@@ -0,0 +1,63 @@
+extern "C" void abort (void);
+
+#include "vbase8-4.h"
+
+void check_C0 (C0 &x, int i)
+{
+ if (x.i0 != i)
+ abort ();
+}
+
+void check_C1 (C1 &x, int i)
+{
+ if (x.i1 != i)
+ abort ();
+}
+
+void check_C2 (C2 &x, int i)
+{
+ if (x.i2 != i)
+ abort ();
+}
+
+void check_C3 (C3 &x, int i)
+{
+ if (x.i3 != i)
+ abort ();
+}
+
+void check_C4 (C4 &x, int i)
+{
+ if (x.i4 != i)
+ abort ();
+}
+
+void check_C5 (C5 &x, int i)
+{
+ if (x.i5 != i)
+ abort ();
+}
+
+void check_C6 (C6 &x, int i)
+{
+ if (x.i6 != i)
+ abort ();
+}
+
+void check_C7 (C7 &x, int i)
+{
+ if (x.i7 != i)
+ abort ();
+}
+
+void check_C8 (C8 &x, int i)
+{
+ if (x.i8 != i)
+ abort ();
+}
+
+void check_C9 (C9 &x, int i)
+{
+ if (x.i9 != i)
+ abort ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/break/README b/gcc/testsuite/g++.dg/compat/break/README
new file mode 100644
index 00000000000..98886310caa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/break/README
@@ -0,0 +1,11 @@
+Tests in this directory are for functionality that has changed in GCC
+from one release to another or that is not ABI-compliant and may change
+in a future release.
+
+Each test header for changed behavior should indicate the version in
+which the behavior changed, in order to help users of these tests to
+determine whether a test failure is expected or not.
+
+Every test in this directory that covers behavior that is not
+ABI-compliant should also be covered by a test for -Wabi to ensure that
+there is a warning for the construct.
diff --git a/gcc/testsuite/g++.dg/compat/break/bitfield5.h b/gcc/testsuite/g++.dg/compat/break/bitfield5.h
new file mode 100644
index 00000000000..6f7f012cc6b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/break/bitfield5.h
@@ -0,0 +1,11 @@
+struct A {
+ virtual void f();
+ int f1 : 1;
+};
+
+struct B : public A {
+ int f2 : 1;
+ int : 0;
+ int f3 : 4;
+ int f4 : 3;
+};
diff --git a/gcc/testsuite/g++.dg/compat/break/bitfield5_main.C b/gcc/testsuite/g++.dg/compat/break/bitfield5_main.C
new file mode 100644
index 00000000000..415a8846c26
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/break/bitfield5_main.C
@@ -0,0 +1,14 @@
+// The offset of `B::f2' is not ABI-compliant and may change in a future
+// version of GCC.
+// g++.dg/abi/bitfield5.C tests this with -Wabi.
+// Split into pieces for binary compatibility testing October 2002
+
+#include "bitfield5.h"
+
+extern void bitfield5_x (void);
+
+int
+main ()
+{
+ bitfield5_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/break/bitfield5_x.C b/gcc/testsuite/g++.dg/compat/break/bitfield5_x.C
new file mode 100644
index 00000000000..9be9372347a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/break/bitfield5_x.C
@@ -0,0 +1,13 @@
+#include "bitfield5.h"
+
+extern void bitfield5_y (B&);
+
+void bitfield5_x ()
+{
+ B b;
+
+ b.f3 = 7;
+ b.f4 = 3;
+
+ bitfield5_y (b);
+}
diff --git a/gcc/testsuite/g++.dg/compat/break/bitfield5_y.C b/gcc/testsuite/g++.dg/compat/break/bitfield5_y.C
new file mode 100644
index 00000000000..6ee4dd0089d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/break/bitfield5_y.C
@@ -0,0 +1,13 @@
+extern "C" void abort (void);
+
+#include "bitfield5.h"
+
+void A::f () {}
+
+void bitfield5_y (B& b)
+{
+ if (b.f3 != 7)
+ abort ();
+ if (b.f4 != 3)
+ abort ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/break/bitfield7.h b/gcc/testsuite/g++.dg/compat/break/bitfield7.h
new file mode 100644
index 00000000000..2060bf7473b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/break/bitfield7.h
@@ -0,0 +1,3 @@
+union U {
+ int i: 4096;
+};
diff --git a/gcc/testsuite/g++.dg/compat/break/bitfield7_main.C b/gcc/testsuite/g++.dg/compat/break/bitfield7_main.C
new file mode 100644
index 00000000000..57bb96101f1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/break/bitfield7_main.C
@@ -0,0 +1,16 @@
+// { dg-options "-w" }
+
+// The size assigned to `U' may not be ABI-compliant and may change in a
+// future version of GCC.
+// g++.dg/abi/bitfield7.C tests this with -Wabi.
+// Split into pieces for binary compatibility testing October 2002
+
+#include "bitfield7.h"
+
+extern void bitfield7_x (void);
+
+int
+main ()
+{
+ bitfield7_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/break/bitfield7_x.C b/gcc/testsuite/g++.dg/compat/break/bitfield7_x.C
new file mode 100644
index 00000000000..b42ea2e9ae3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/break/bitfield7_x.C
@@ -0,0 +1,13 @@
+#include "bitfield7.h"
+
+extern void bitfield7_y (U*);
+
+void bitfield7_x ()
+{
+ U u[2];
+
+ u[0].i = 7;
+ u[1].i = 8;
+
+ bitfield7_y (u);
+}
diff --git a/gcc/testsuite/g++.dg/compat/break/bitfield7_y.C b/gcc/testsuite/g++.dg/compat/break/bitfield7_y.C
new file mode 100644
index 00000000000..916d150d537
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/break/bitfield7_y.C
@@ -0,0 +1,11 @@
+extern "C" void abort (void);
+
+#include "bitfield7.h"
+
+void bitfield7_y (U* u)
+{
+ if (u[0].i != 7)
+ abort ();
+ if (u[1].i != 8)
+ abort ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/break/empty6.h b/gcc/testsuite/g++.dg/compat/break/empty6.h
new file mode 100644
index 00000000000..47a0da8b52e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/break/empty6.h
@@ -0,0 +1,7 @@
+struct A {};
+
+struct B {
+ A a;
+ virtual void f () {}
+ int i;
+};
diff --git a/gcc/testsuite/g++.dg/compat/break/empty6_main.C b/gcc/testsuite/g++.dg/compat/break/empty6_main.C
new file mode 100644
index 00000000000..bf6d982413b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/break/empty6_main.C
@@ -0,0 +1,14 @@
+// `B::a' contains empty classes which may cause base classes to be
+// placed at different locations in a future version of GCC.
+// g++.dg/abi/empty6.C tests this with -Wabi.
+// Split into pieces for binary compatibility testing October 2002
+
+#include "empty6.h"
+
+extern void empty6_x (void);
+
+int
+main ()
+{
+ empty6_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/break/empty6_x.C b/gcc/testsuite/g++.dg/compat/break/empty6_x.C
new file mode 100644
index 00000000000..f7e25e9abf9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/break/empty6_x.C
@@ -0,0 +1,12 @@
+#include "empty6.h"
+
+extern void empty6_y (B&);
+
+void empty6_x ()
+{
+ B b;
+
+ b.i = 7;
+
+ empty6_y (b);
+}
diff --git a/gcc/testsuite/g++.dg/compat/break/empty6_y.C b/gcc/testsuite/g++.dg/compat/break/empty6_y.C
new file mode 100644
index 00000000000..cb3d45c9e15
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/break/empty6_y.C
@@ -0,0 +1,9 @@
+extern "C" void abort (void);
+
+#include "empty6.h"
+
+void empty6_y (B& b)
+{
+ if (b.i != 7)
+ abort ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/break/vbase10.h b/gcc/testsuite/g++.dg/compat/break/vbase10.h
new file mode 100644
index 00000000000..f418d1e56a4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/break/vbase10.h
@@ -0,0 +1,12 @@
+struct A {
+ virtual void f();
+ char c1;
+};
+
+struct B {
+ B();
+ char c2;
+};
+
+struct C : public A, public virtual B {
+};
diff --git a/gcc/testsuite/g++.dg/compat/break/vbase10_main.C b/gcc/testsuite/g++.dg/compat/break/vbase10_main.C
new file mode 100644
index 00000000000..a082b5dbf3e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/break/vbase10_main.C
@@ -0,0 +1,14 @@
+// The offset of virtual base `B' is not ABI-compliant and may change in
+// a future version of GCC.
+// g++.dg/abi/vbase10.C tests this with -Wabi.
+// Split into pieces for binary compatibility testing October 2002
+
+#include "vbase10.h"
+
+extern void vbase10_x (void);
+
+int
+main ()
+{
+ vbase10_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/break/vbase10_x.C b/gcc/testsuite/g++.dg/compat/break/vbase10_x.C
new file mode 100644
index 00000000000..6d51d3c7269
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/break/vbase10_x.C
@@ -0,0 +1,13 @@
+#include "vbase10.h"
+
+extern void vbase10_y (C&);
+
+void vbase10_x ()
+{
+ C c;
+
+ c.c1 = 1;
+ c.c2 = 2;
+
+ vbase10_y (c);
+}
diff --git a/gcc/testsuite/g++.dg/compat/break/vbase10_y.C b/gcc/testsuite/g++.dg/compat/break/vbase10_y.C
new file mode 100644
index 00000000000..70ce0075e66
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/break/vbase10_y.C
@@ -0,0 +1,14 @@
+extern "C" void abort (void);
+
+#include "vbase10.h"
+
+void A::f () {}
+B::B() {}
+
+void vbase10_y (C& c)
+{
+ if (c.c1 != 1)
+ abort ();
+ if (c.c2 != 2)
+ abort ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/break/vbase11.h b/gcc/testsuite/g++.dg/compat/break/vbase11.h
new file mode 100644
index 00000000000..a298f764415
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/break/vbase11.h
@@ -0,0 +1,12 @@
+struct base
+{
+ short b;
+ virtual int foo();
+};
+
+struct derived: virtual base
+{
+ int d;
+ virtual int foo();
+ virtual int bar();
+};
diff --git a/gcc/testsuite/g++.dg/compat/break/vbase11_main.C b/gcc/testsuite/g++.dg/compat/break/vbase11_main.C
new file mode 100644
index 00000000000..2ac59944992
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/break/vbase11_main.C
@@ -0,0 +1,13 @@
+// Test case from PR 7470, which was fixed in GCC 3.2 and breaks binary
+// compatibility with earlier releases.
+// Split into pieces for binary compatibility testing October 2002
+
+#include "vbase11.h"
+
+extern void vbase11_x (void);
+
+int
+main ()
+{
+ vbase11_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/break/vbase11_x.C b/gcc/testsuite/g++.dg/compat/break/vbase11_x.C
new file mode 100644
index 00000000000..4b2398ae10d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/break/vbase11_x.C
@@ -0,0 +1,14 @@
+#include "vbase11.h"
+
+extern void vbase11_y (derived&);
+
+int base::foo() { return 1; }
+int derived::foo() { return 2; }
+int derived::bar() { return 3; }
+
+void vbase11_x ()
+{
+ derived d;
+
+ vbase11_y (d);
+}
diff --git a/gcc/testsuite/g++.dg/compat/break/vbase11_y.C b/gcc/testsuite/g++.dg/compat/break/vbase11_y.C
new file mode 100644
index 00000000000..01ca62b87b8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/break/vbase11_y.C
@@ -0,0 +1,11 @@
+extern "C" void abort (void);
+
+#include "vbase11.h"
+
+void vbase11_y (derived& d)
+{
+ if (d.foo() != 2)
+ abort ();
+ if (d.bar() != 3)
+ abort ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/compat.exp b/gcc/testsuite/g++.dg/compat/compat.exp
new file mode 100644
index 00000000000..1e13c102a50
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/compat.exp
@@ -0,0 +1,137 @@
+# Copyright (C) 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# This file was written by Janis Johnson, <janis187@us.ibm.com>
+
+
+# Test interoperability of two compilers that follow the same ABI.
+#
+# Break simple tests into two pieces and see that they work when linked
+# together. If an alternate compiler is specified then the two main
+# pieces of each test are compiled with different compilers. The
+# alternate compiler must be installed, and is specified by defining
+# ALT_CXX_UNDER_TEST in the environment.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+global GXX_UNDER_TEST
+global ld_library_path
+
+# Load procedures from common libraries.
+load_lib standard.exp
+load_lib g++.exp
+
+#
+# compat-fix-library-path -- switch LD_LIBRARY_PATH
+#
+proc compat-fix-library-path { } {
+ global ld_library_path
+
+ # See comments in lib/g++.exp for why this is needed.
+ setenv LD_LIBRARY_PATH $ld_library_path
+ setenv SHLIB_PATH $ld_library_path
+ setenv LD_LIBRARYN32_PATH $ld_library_path
+ setenv LD_LIBRARY64_PATH $ld_library_path
+}
+
+#
+# compat-use-alt-compiler -- make the alternate compiler the default
+#
+proc compat-use-alt-compiler { } {
+ global GXX_UNDER_TEST ALT_CXX_UNDER_TEST
+ global CXXFLAGS
+ global ALWAYS_CXXFLAGS
+ global ld_library_path alt_ld_library_path
+ global same_alt
+
+ # We don't need to do this if the alternate compiler is actually
+ # the same as the compiler under test.
+ if { $same_alt == 0 } then {
+ set GXX_UNDER_TEST $ALT_CXX_UNDER_TEST
+ set CXXFLAGS ""
+ set ALWAYS_CXXFLAGS ""
+ set ld_library_path $alt_ld_library_path
+ compat-fix-library-path
+ }
+}
+
+#
+# compat-use-tst-compiler -- make compiler under test the default
+#
+proc compat-use-tst-compiler { } {
+ global GXX_UNDER_TEST save_gxx_under_test
+ global CXXFLAGS save_cxxflags
+ global ALWAYS_CXXFLAGS save_always_cxxflags
+ global ld_library_path save_ld_library_path
+ global same_alt
+
+ # We don't need to do this if the alternate compiler is actually
+ # the same as the compiler under test.
+
+ if { $same_alt == 0 } then {
+ set GXX_UNDER_TEST $save_gxx_under_test
+ set CXXFLAGS $save_cxxflags
+ set ALWAYS_CXXFLAGS $save_always_cxxflags
+ set ld_library_path $save_ld_library_path
+ compat-fix-library-path
+ }
+}
+
+# Load the language-independent compabibility support procedures.
+# This must be done after the compat-use-*-compiler definitions.
+load_lib compat.exp
+
+g++_init
+
+# Save variables for the C++ compiler under test, which each test will
+# change a couple of times. This must be done after calling g++-init.
+set save_gxx_under_test $GXX_UNDER_TEST
+set save_cxxflags $CXXFLAGS
+set save_always_cxxflags $ALWAYS_CXXFLAGS
+set save_ld_library_path $ld_library_path
+
+# Find out whether there is an alternate compiler to test. If the
+# variable is defined but is set to "same", that means we use the same
+# compiler twice, which is meaningful if the two parts of COMPAT_OPTIONS
+# are different.
+set use_alt 0
+set same_alt 0
+set alt_ld_library_path "."
+if [info exists ALT_CXX_UNDER_TEST] then {
+ set use_alt 1
+ if [string match "same" $ALT_CXX_UNDER_TEST] then {
+ set same_alt 1
+ } else {
+ if [info exists ALT_LD_LIBRARY_PATH] then {
+ append alt_ld_library_path ":${ALT_LD_LIBRARY_PATH}"
+ }
+ }
+}
+
+# Main loop.
+foreach src [lsort [find $srcdir/$subdir *_main.C]] {
+ # If we're only testing specific files and this isn't one of them, skip it.
+ if ![runtest_file_p $runtests $src] then {
+ continue
+ }
+
+ compat-execute $src $use_alt
+}
+
+# Restore the original compiler under test.
+compat-use-tst-compiler
diff --git a/gcc/testsuite/g++.dg/compat/eh/ctor1.h b/gcc/testsuite/g++.dg/compat/eh/ctor1.h
new file mode 100644
index 00000000000..e83476f2d60
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/ctor1.h
@@ -0,0 +1,10 @@
+struct Foo
+{
+ ~Foo ();
+};
+
+struct Bar
+{
+ ~Bar ();
+ Foo f;
+};
diff --git a/gcc/testsuite/g++.dg/compat/eh/ctor1_main.C b/gcc/testsuite/g++.dg/compat/eh/ctor1_main.C
new file mode 100644
index 00000000000..a188b46da86
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/ctor1_main.C
@@ -0,0 +1,13 @@
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 26 Dec 2001 <nathan@nathan@codesourcery.com>
+// PR 411
+
+// Split into pieces for binary compatibility testing October 2002
+
+extern void ctor1_x (void);
+
+int
+main ()
+{
+ ctor1_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/ctor1_x.C b/gcc/testsuite/g++.dg/compat/eh/ctor1_x.C
new file mode 100644
index 00000000000..d74a520871f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/ctor1_x.C
@@ -0,0 +1,22 @@
+extern "C" void abort (void);
+extern "C" void exit (int);
+
+#include "ctor1.h"
+
+bool was_f_in_Bar_destroyed=false;
+
+void ctor1_x ()
+{
+ try
+ {
+ Bar f;
+ }
+ catch(int i)
+ {
+ if(was_f_in_Bar_destroyed)
+ {
+ exit (0);
+ }
+ }
+ abort ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/ctor1_y.C b/gcc/testsuite/g++.dg/compat/eh/ctor1_y.C
new file mode 100644
index 00000000000..260ab1c3418
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/ctor1_y.C
@@ -0,0 +1,13 @@
+extern bool was_f_in_Bar_destroyed;
+
+#include "ctor1.h"
+
+Foo::~Foo()
+{
+ was_f_in_Bar_destroyed=true;
+}
+
+Bar::~Bar()
+{
+ throw 1;
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/ctor2.h b/gcc/testsuite/g++.dg/compat/eh/ctor2.h
new file mode 100644
index 00000000000..c6b9f40f8d9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/ctor2.h
@@ -0,0 +1,22 @@
+struct VBase
+{
+ virtual void f () {}
+ VBase();
+ ~VBase();
+};
+
+struct StreamBase
+{
+ virtual ~StreamBase() {}
+};
+
+struct Stream : public virtual VBase, public StreamBase
+{
+ Stream();
+ virtual ~Stream() {}
+};
+
+struct DerivedStream : public Stream
+{
+ DerivedStream();
+};
diff --git a/gcc/testsuite/g++.dg/compat/eh/ctor2_main.C b/gcc/testsuite/g++.dg/compat/eh/ctor2_main.C
new file mode 100644
index 00000000000..58836e26eba
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/ctor2_main.C
@@ -0,0 +1,12 @@
+// PR c++/4460
+// Test that the cleanup for fully-constructed subobjects when a
+// constructor throws gets the right address for a virtual base.
+
+// Split into pieces for binary compatibility testing October 2002
+
+extern void ctor2_x (void);
+
+int main ()
+{
+ ctor2_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/ctor2_x.C b/gcc/testsuite/g++.dg/compat/eh/ctor2_x.C
new file mode 100644
index 00000000000..3fa1a53ace5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/ctor2_x.C
@@ -0,0 +1,19 @@
+extern "C" void exit (int);
+extern "C" void abort (void);
+
+#include "ctor2.h"
+
+int r;
+
+void ctor2_x () {
+
+ try
+ {
+ DerivedStream str;
+ }
+ catch (...) { }
+
+ if (r != 0)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/ctor2_y.C b/gcc/testsuite/g++.dg/compat/eh/ctor2_y.C
new file mode 100644
index 00000000000..00ba92000e4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/ctor2_y.C
@@ -0,0 +1,20 @@
+extern int r;
+void *p;
+
+#include "ctor2.h"
+
+VBase::VBase ()
+{
+ p = this;
+}
+
+VBase::~VBase ()
+{
+ if (p != this) r = 1;
+}
+
+Stream::Stream () {}
+DerivedStream::DerivedStream ()
+{
+ throw 1;
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/dtor1.h b/gcc/testsuite/g++.dg/compat/eh/dtor1.h
new file mode 100644
index 00000000000..0dfa793e0e1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/dtor1.h
@@ -0,0 +1,7 @@
+struct A {
+ ~A();
+};
+
+struct B: public A {
+ ~B();
+};
diff --git a/gcc/testsuite/g++.dg/compat/eh/dtor1_main.C b/gcc/testsuite/g++.dg/compat/eh/dtor1_main.C
new file mode 100644
index 00000000000..962fa64274b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/dtor1_main.C
@@ -0,0 +1,14 @@
+// PR c++/411
+
+// Test that a fully-constructed base is destroyed before transferring
+// control to the handler of a function-try-block.
+
+// Split into pieces for binary compatibility testing October 2002
+
+extern void dtor1_x (void);
+
+int
+main ()
+{
+ dtor1_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/dtor1_x.C b/gcc/testsuite/g++.dg/compat/eh/dtor1_x.C
new file mode 100644
index 00000000000..f7f4cc8a7f7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/dtor1_x.C
@@ -0,0 +1,14 @@
+extern "C" void exit (int);
+extern "C" void abort (void);
+
+#include "dtor1.h"
+
+int r;
+
+void dtor1_x ()
+{
+ { B b; }
+ if (r != 0)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/dtor1_y.C b/gcc/testsuite/g++.dg/compat/eh/dtor1_y.C
new file mode 100644
index 00000000000..a1ec41a2764
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/dtor1_y.C
@@ -0,0 +1,18 @@
+extern int r;
+int ad;
+
+#include "dtor1.h"
+
+A::~A () { ++ad; }
+
+B::~B ()
+try
+ {
+ throw 1;
+ }
+catch (...)
+ {
+ if (!ad)
+ r = 1;
+ return;
+ }
diff --git a/gcc/testsuite/g++.dg/compat/eh/filter1.h b/gcc/testsuite/g++.dg/compat/eh/filter1.h
new file mode 100644
index 00000000000..1f5f0c93615
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/filter1.h
@@ -0,0 +1,5 @@
+struct a
+{
+ a();
+ ~a();
+};
diff --git a/gcc/testsuite/g++.dg/compat/eh/filter1_main.C b/gcc/testsuite/g++.dg/compat/eh/filter1_main.C
new file mode 100644
index 00000000000..2a8fca42c31
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/filter1_main.C
@@ -0,0 +1,11 @@
+// Test that cleanups get run when a catch filter fails to match.
+
+// Split into pieces for binary compatibility testing October 2002
+
+extern void filter1_x (void);
+
+int
+main ()
+{
+ filter1_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/filter1_x.C b/gcc/testsuite/g++.dg/compat/eh/filter1_x.C
new file mode 100644
index 00000000000..b3789aa15b7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/filter1_x.C
@@ -0,0 +1,21 @@
+#include "filter1.h"
+
+extern "C" void exit (int);
+extern "C" void abort (void);
+extern void ex_test (void);
+
+void
+filter1_x ()
+{
+ try
+ {
+ ex_test ();
+ }
+ catch (...)
+ {
+ }
+ abort ();
+}
+
+a::a() { }
+a::~a() { exit (0); }
diff --git a/gcc/testsuite/g++.dg/compat/eh/filter1_y.C b/gcc/testsuite/g++.dg/compat/eh/filter1_y.C
new file mode 100644
index 00000000000..48de0877d54
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/filter1_y.C
@@ -0,0 +1,17 @@
+#include "filter1.h"
+
+struct e1 {};
+struct e2 {};
+
+void
+ex_test ()
+{
+ a aa;
+ try
+ {
+ throw e1 ();
+ }
+ catch (e2 &)
+ {
+ }
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/filter2_main.C b/gcc/testsuite/g++.dg/compat/eh/filter2_main.C
new file mode 100644
index 00000000000..866199c6b30
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/filter2_main.C
@@ -0,0 +1,12 @@
+// Test that terminate gets run when a catch filter fails to match while
+// running destructors. Original bug depended on a::~a being inlined.
+
+// Split into pieces for binary compatibility testing October 2002
+
+extern void filter2_x (void);
+
+int
+main ()
+{
+ filter2_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/filter2_x.C b/gcc/testsuite/g++.dg/compat/eh/filter2_x.C
new file mode 100644
index 00000000000..cdbfffffdd1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/filter2_x.C
@@ -0,0 +1,20 @@
+#include <exception>
+#include <cstdlib>
+
+extern void my_terminate (void);
+extern void ex_test (void);
+
+void
+filter2_x ()
+{
+ std::set_terminate (my_terminate);
+
+ try
+ {
+ ex_test ();
+ }
+ catch (...)
+ {
+ }
+ abort ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/filter2_y.C b/gcc/testsuite/g++.dg/compat/eh/filter2_y.C
new file mode 100644
index 00000000000..87c6fea1012
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/filter2_y.C
@@ -0,0 +1,39 @@
+#include <exception>
+#include <cstdlib>
+
+struct e1 {};
+struct e2 {};
+
+struct a
+{
+ a () { }
+
+ ~a ()
+ {
+ try
+ {
+ throw e1();
+ }
+ catch (e2 &)
+ {
+ }
+ }
+};
+
+void
+ex_test ()
+{
+ a aa;
+ try
+ {
+ throw e1 ();
+ }
+ catch (e2 &)
+ {
+ }
+}
+
+void my_terminate ()
+{
+ std::exit (0);
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/new1_main.C b/gcc/testsuite/g++.dg/compat/eh/new1_main.C
new file mode 100644
index 00000000000..ee4cad8e50d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/new1_main.C
@@ -0,0 +1,13 @@
+// PR c++/5757
+// Test that when a constructor throws in a new-expression, we pass the
+// right pointer to operator delete.
+
+// Split into pieces for binary compatibility testing October 2002
+
+extern void new1_x (void);
+
+int
+main ()
+{
+ new1_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/new1_x.C b/gcc/testsuite/g++.dg/compat/eh/new1_x.C
new file mode 100644
index 00000000000..4ca3be0af90
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/new1_x.C
@@ -0,0 +1,28 @@
+#include <new>
+
+extern "C" void exit (int);
+extern "C" void abort (void);
+
+extern void * operator new[] (size_t s) throw (std::bad_alloc);
+extern void operator delete[] (void *p) throw ();
+
+struct A
+{
+ A() { throw 1; }
+ ~A() {}
+};
+
+int ret = 1;
+
+void
+new1_x ()
+{
+ try
+ {
+ A *p = new A[4];
+ }
+ catch (...) {}
+ if (ret != 0)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/new1_y.C b/gcc/testsuite/g++.dg/compat/eh/new1_y.C
new file mode 100644
index 00000000000..c448cbed8d2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/new1_y.C
@@ -0,0 +1,18 @@
+#include <new>
+
+extern int ret;
+
+void *ptr;
+void * operator new[] (size_t s) throw (std::bad_alloc)
+{
+ ptr = operator new (s);
+ return ptr;
+}
+
+void operator delete[] (void *p) throw ()
+{
+ if (p == ptr)
+ ret = 0;
+ operator delete (p);
+}
+
diff --git a/gcc/testsuite/g++.dg/compat/eh/nrv1.h b/gcc/testsuite/g++.dg/compat/eh/nrv1.h
new file mode 100644
index 00000000000..853ea3914e1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/nrv1.h
@@ -0,0 +1,5 @@
+struct A
+{
+ A();
+ ~A();
+};
diff --git a/gcc/testsuite/g++.dg/compat/eh/nrv1_main.C b/gcc/testsuite/g++.dg/compat/eh/nrv1_main.C
new file mode 100644
index 00000000000..3b76b5c8824
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/nrv1_main.C
@@ -0,0 +1,12 @@
+// PR c++/5636
+// Bug: the named return value optimization interfered with EH cleanups.
+
+// Split into pieces for binary compatibility testing October 2002
+
+extern void nrv1_x (void);
+
+int
+main ()
+{
+ nrv1_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/nrv1_x.C b/gcc/testsuite/g++.dg/compat/eh/nrv1_x.C
new file mode 100644
index 00000000000..0647de889a5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/nrv1_x.C
@@ -0,0 +1,21 @@
+extern "C" void exit (int);
+extern "C" void abort (void);
+
+#include "nrv1.h"
+
+extern A f (void);
+
+int c, d;
+
+void nrv1_x ()
+{
+ try
+ { A a = f(); }
+ catch (...) { }
+ if (d < c)
+ abort ();
+ exit (0);
+}
+
+A::A() { ++c; }
+A::~A() { ++d; }
diff --git a/gcc/testsuite/g++.dg/compat/eh/nrv1_y.C b/gcc/testsuite/g++.dg/compat/eh/nrv1_y.C
new file mode 100644
index 00000000000..5a43af7c205
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/nrv1_y.C
@@ -0,0 +1,8 @@
+#include "nrv1.h"
+
+A f()
+{
+ A nrv;
+ throw 42;
+ return nrv;
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/spec3.h b/gcc/testsuite/g++.dg/compat/eh/spec3.h
new file mode 100644
index 00000000000..a042c1004dd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/spec3.h
@@ -0,0 +1,8 @@
+class Base {};
+
+struct A : virtual public Base
+{
+ A();
+};
+
+struct B {};
diff --git a/gcc/testsuite/g++.dg/compat/eh/spec3_main.C b/gcc/testsuite/g++.dg/compat/eh/spec3_main.C
new file mode 100644
index 00000000000..3f0e919b2ea
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/spec3_main.C
@@ -0,0 +1,12 @@
+// PR c++/4381
+// Test that exception-specs work properly for classes with virtual bases.
+
+// Split into pieces for binary compatibility testing October 2002
+
+extern void spec3_x (void);
+
+int
+main ()
+{
+ spec3_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/spec3_x.C b/gcc/testsuite/g++.dg/compat/eh/spec3_x.C
new file mode 100644
index 00000000000..b8e5fbeaa1e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/spec3_x.C
@@ -0,0 +1,9 @@
+#include "spec3.h"
+
+extern void func () throw (B,A);
+
+void spec3_x (void)
+{
+ try { func(); }
+ catch (A& a) { }
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/spec3_y.C b/gcc/testsuite/g++.dg/compat/eh/spec3_y.C
new file mode 100644
index 00000000000..fef6b368c86
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/spec3_y.C
@@ -0,0 +1,8 @@
+#include "spec3.h"
+
+A::A() {}
+
+void func() throw (B,A)
+{
+ throw A();
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/template1.h b/gcc/testsuite/g++.dg/compat/eh/template1.h
new file mode 100644
index 00000000000..93999a11d49
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/template1.h
@@ -0,0 +1,15 @@
+class A {};
+
+template <class T>
+struct B
+{
+ typedef A E;
+};
+
+template <class T>
+struct C
+{
+ typedef B<T> D;
+ typedef typename D::E E;
+ void f() throw(E);
+};
diff --git a/gcc/testsuite/g++.dg/compat/eh/template1_main.C b/gcc/testsuite/g++.dg/compat/eh/template1_main.C
new file mode 100644
index 00000000000..2d169808c46
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/template1_main.C
@@ -0,0 +1,12 @@
+// Test whether exception specifier dependent on template parameter
+// is accepted during template decl processing.
+
+// Split into pieces for binary compatibility testing October 2002
+
+extern void template1_x (void);
+
+int
+main ()
+{
+ template1_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/template1_x.C b/gcc/testsuite/g++.dg/compat/eh/template1_x.C
new file mode 100644
index 00000000000..5a18be78989
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/template1_x.C
@@ -0,0 +1,21 @@
+extern "C" void exit (int);
+extern "C" void abort (void);
+
+#include "template1.h"
+
+void template1_x ()
+{
+ int caught = 0;
+ try
+ {
+ C<int> x;
+ x.f();
+ }
+ catch (A)
+ {
+ ++caught;
+ }
+ if (caught != 1)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/template1_y.C b/gcc/testsuite/g++.dg/compat/eh/template1_y.C
new file mode 100644
index 00000000000..19425375c92
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/template1_y.C
@@ -0,0 +1,8 @@
+#include "template1.h"
+
+template<class T> void C<T>::f (void) throw (E)
+{
+ throw E();
+}
+
+template class C<int>;
diff --git a/gcc/testsuite/g++.dg/compat/eh/unexpected1_main.C b/gcc/testsuite/g++.dg/compat/eh/unexpected1_main.C
new file mode 100644
index 00000000000..1658db77e32
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/unexpected1_main.C
@@ -0,0 +1,12 @@
+// PR 3719
+// Test that an unexpected handler can rethrow to categorize.
+
+// Split into pieces for binary compatibility testing October 2002
+
+extern void unexpected1_x ();
+
+int
+main ()
+{
+ unexpected1_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/unexpected1_x.C b/gcc/testsuite/g++.dg/compat/eh/unexpected1_x.C
new file mode 100644
index 00000000000..61361a68d9f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/unexpected1_x.C
@@ -0,0 +1,26 @@
+#include <exception>
+
+struct One { };
+struct Two { };
+
+extern "C" void abort ();
+extern void doit (void) throw (Two);
+extern void handle_unexpected (void);
+
+void
+unexpected1_x ()
+{
+ std::set_unexpected (handle_unexpected);
+
+ try
+ {
+ doit ();
+ }
+ catch (Two &)
+ {
+ }
+ catch (...)
+ {
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/unexpected1_y.C b/gcc/testsuite/g++.dg/compat/eh/unexpected1_y.C
new file mode 100644
index 00000000000..0c42c457953
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/eh/unexpected1_y.C
@@ -0,0 +1,21 @@
+struct One { };
+struct Two { };
+
+void
+handle_unexpected ()
+{
+ try
+ {
+ throw;
+ }
+ catch (One &)
+ {
+ throw Two ();
+ }
+}
+
+void
+doit () throw (Two)
+{
+ throw One ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/init/array5_main.C b/gcc/testsuite/g++.dg/compat/init/array5_main.C
new file mode 100644
index 00000000000..96b2cc4b12b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/init/array5_main.C
@@ -0,0 +1,14 @@
+// Copyright (C) 2002 Free Software Foundation
+// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+// Split into pieces for binary compatibility testing October 2002
+
+// Incorrect construction and destruction of multi-dimensional
+// array of class.
+
+extern void array5_x (void);
+
+int
+main ()
+{
+ array5_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/init/array5_x.C b/gcc/testsuite/g++.dg/compat/init/array5_x.C
new file mode 100644
index 00000000000..dc138772cdd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/init/array5_x.C
@@ -0,0 +1,33 @@
+extern "C" void abort (void);
+
+extern int count;
+extern int num;
+
+struct A
+{
+ A();
+ ~A();
+};
+
+struct Array
+{
+ A array[2][2][2];
+};
+
+void
+array5_x ()
+{
+ for (num = 0; num <= 8; ++num)
+ {
+ count = 0;
+ try
+ {
+ Array A;
+ }
+ catch (...)
+ {
+ }
+ if (count != 0)
+ abort();
+ }
+}
diff --git a/gcc/testsuite/g++.dg/compat/init/array5_y.C b/gcc/testsuite/g++.dg/compat/init/array5_y.C
new file mode 100644
index 00000000000..64b295ed56d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/init/array5_y.C
@@ -0,0 +1,20 @@
+int count;
+int num;
+
+struct A
+{
+ A();
+ ~A();
+};
+
+A::A()
+{
+ if (count == num)
+ throw "";
+ count++;
+}
+
+A::~A()
+{
+ count--;
+}
diff --git a/gcc/testsuite/g++.dg/compat/init/byval1.h b/gcc/testsuite/g++.dg/compat/init/byval1.h
new file mode 100644
index 00000000000..2876b76ede1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/init/byval1.h
@@ -0,0 +1,6 @@
+struct C
+{
+ int m;
+ C();
+ ~C();
+};
diff --git a/gcc/testsuite/g++.dg/compat/init/byval1_main.C b/gcc/testsuite/g++.dg/compat/init/byval1_main.C
new file mode 100644
index 00000000000..acefaab1440
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/init/byval1_main.C
@@ -0,0 +1,12 @@
+// PR c++/3948
+// Test that the destructor call for a value parameter gets the
+// right address.
+// Split into pieces for binary compatibility testing October 2002
+
+extern void byval1_x (void);
+
+int
+main ()
+{
+ byval1_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/init/byval1_x.C b/gcc/testsuite/g++.dg/compat/init/byval1_x.C
new file mode 100644
index 00000000000..248dbe763bc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/init/byval1_x.C
@@ -0,0 +1,15 @@
+#include "byval1.h"
+
+extern "C" void abort (void);
+extern void Foo (C c);
+extern int r;
+
+void
+byval1_x ()
+{
+ C c;
+
+ Foo (c);
+ if (r != 0)
+ abort ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/init/byval1_y.C b/gcc/testsuite/g++.dg/compat/init/byval1_y.C
new file mode 100644
index 00000000000..6e217e84ec5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/init/byval1_y.C
@@ -0,0 +1,14 @@
+#include "byval1.h"
+
+void *p[2];
+
+int i;
+int r;
+
+C::C() { p[i++] = this; }
+C::~C() { if (p[--i] != this) r = 1; }
+
+void Foo (C c)
+{
+ p[i++] = &c;
+}
diff --git a/gcc/testsuite/g++.dg/compat/init/dtor1.h b/gcc/testsuite/g++.dg/compat/init/dtor1.h
new file mode 100644
index 00000000000..77e21c12ef2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/init/dtor1.h
@@ -0,0 +1,30 @@
+struct B
+{
+ int x;
+ B (int);
+ ~B ();
+};
+
+struct C1 : public B {
+ C1 (int);
+};
+
+struct C2 : public B {
+ C2 (int);
+};
+
+struct D : public B {
+ D (int);
+};
+
+struct E : public B {
+ E (int);
+};
+
+struct A
+ : public C1, C2, virtual public D, virtual public E
+{
+ A ();
+ B x1;
+ B x2;
+};
diff --git a/gcc/testsuite/g++.dg/compat/init/dtor1_main.C b/gcc/testsuite/g++.dg/compat/init/dtor1_main.C
new file mode 100644
index 00000000000..78868784038
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/init/dtor1_main.C
@@ -0,0 +1,9 @@
+// Split into pieces for binary compatibility testing October 2002
+
+extern void dtor1_x (void);
+
+int
+main ()
+{
+ dtor1_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/init/dtor1_x.C b/gcc/testsuite/g++.dg/compat/init/dtor1_x.C
new file mode 100644
index 00000000000..8a4727cfb4c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/init/dtor1_x.C
@@ -0,0 +1,7 @@
+#include "dtor1.h"
+
+void
+dtor1_x (void)
+{
+ A a;
+}
diff --git a/gcc/testsuite/g++.dg/compat/init/dtor1_y.C b/gcc/testsuite/g++.dg/compat/init/dtor1_y.C
new file mode 100644
index 00000000000..27610fc1e9e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/init/dtor1_y.C
@@ -0,0 +1,18 @@
+#include "dtor1.h"
+
+extern "C" void abort ();
+
+int d = 5;
+
+B::B (int i) : x (i) { }
+B::~B () { if (d-- != x) abort (); }
+
+C1::C1 (int i) : B (i) {}
+
+C2::C2 (int i) : B (i) {}
+
+D::D (int i) : B (i) {}
+
+E::E (int i) : B (i) {}
+
+A::A () : D (0), E (1), C1 (2), C2 (3), x1(4), x2(5) {}
diff --git a/gcc/testsuite/g++.dg/compat/init/elide1.h b/gcc/testsuite/g++.dg/compat/init/elide1.h
new file mode 100644
index 00000000000..481e7308b5f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/init/elide1.h
@@ -0,0 +1,5 @@
+struct A {
+ A ();
+ A (const A&);
+ ~A ();
+};
diff --git a/gcc/testsuite/g++.dg/compat/init/elide1_main.C b/gcc/testsuite/g++.dg/compat/init/elide1_main.C
new file mode 100644
index 00000000000..c08d02fff45
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/init/elide1_main.C
@@ -0,0 +1,25 @@
+// Test that the destructor for a temporary passed by value isn't run
+// until end of full-expression, as per [class.copy]:
+
+// Whenever a temporary class object is copied using a copy constructor,
+// and this object and the copy have the same cv-unqualified type, an
+// implementation is permitted to treat the original and the copy as two
+// different ways of referring to the same object and not perform a copy
+// at all, even if the class copy constructor or destructor have side
+// effects.... In these cases, the
+// object is destroyed at the later of times when the original and the
+// copy would have been destroyed without the optimization.
+
+// Here, the temporary would be destroyed later than the parm, so either we
+// must suppress the optimization in this case or destroy value parms in the
+// caller.
+
+// Split into pieces for binary compatibility testing October 2002
+
+extern void elide1_x (void);
+
+int
+main ()
+{
+ elide1_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/init/elide1_x.C b/gcc/testsuite/g++.dg/compat/init/elide1_x.C
new file mode 100644
index 00000000000..dbc287e4e2c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/init/elide1_x.C
@@ -0,0 +1,15 @@
+#include "elide1.h"
+
+extern "C" void abort (void);
+extern void f (A);
+extern int d;
+
+void
+elide1_x (void)
+{
+ int r;
+ f (A ()), r = d;
+
+ if (r >= d || !d)
+ abort ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/init/elide1_y.C b/gcc/testsuite/g++.dg/compat/init/elide1_y.C
new file mode 100644
index 00000000000..e767d08082e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/init/elide1_y.C
@@ -0,0 +1,9 @@
+#include "elide1.h"
+
+int d;
+
+A::A () { }
+A::A (const A&) { }
+A::~A() { ++d; }
+
+void f (A a) { }
diff --git a/gcc/testsuite/g++.dg/compat/init/init-ref2_main.C b/gcc/testsuite/g++.dg/compat/init/init-ref2_main.C
new file mode 100644
index 00000000000..73782829ec4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/init/init-ref2_main.C
@@ -0,0 +1,11 @@
+// Submitted by Jason Merrill <jason_merrill@redhat.com>
+// Test for proper handling of local static references.
+// Split into pieces for binary compatibility testing October 2002
+
+extern void init_ref2_x (void);
+
+int
+main ()
+{
+ init_ref2_x ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/init/init-ref2_x.C b/gcc/testsuite/g++.dg/compat/init/init-ref2_x.C
new file mode 100644
index 00000000000..7fbec89b645
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/init/init-ref2_x.C
@@ -0,0 +1,22 @@
+extern "C" void abort (void);
+extern void g (void);
+extern void h (void);
+
+int r;
+int c;
+int f ()
+{
+ // Test that we only initialize i once.
+ if (++c > 1)
+ ++r;
+ return 42;
+}
+
+void
+init_ref2_x (void)
+{
+ g ();
+ h ();
+ if (r != 0)
+ abort ();
+}
diff --git a/gcc/testsuite/g++.dg/compat/init/init-ref2_y.C b/gcc/testsuite/g++.dg/compat/init/init-ref2_y.C
new file mode 100644
index 00000000000..23e66b2f9a1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/compat/init/init-ref2_y.C
@@ -0,0 +1,24 @@
+extern int f (void);
+extern int r;
+
+const int *p;
+
+void g ()
+{
+ static const int &i = f();
+
+ // Test that i points to the same place in both calls.
+ if (p && p != &i)
+ ++r;
+ // Test that if so, it points to static data.
+ if (i != 42)
+ ++r;
+
+ p = &i;
+}
+
+void h ()
+{
+ int arr[] = { 1, 1, 1, 1, 1, 1, 1 };
+ g ();
+}
diff --git a/gcc/testsuite/g++.dg/dg.exp b/gcc/testsuite/g++.dg/dg.exp
index 9e48af8f914..ea96197332f 100644
--- a/gcc/testsuite/g++.dg/dg.exp
+++ b/gcc/testsuite/g++.dg/dg.exp
@@ -32,6 +32,7 @@ dg-init
# that are handled specially.
set tests [lsort [find $srcdir/$subdir *.C]]
set tests [prune $tests $srcdir/$subdir/bprob/*]
+set tests [prune $tests $srcdir/$subdir/compat/*]
set tests [prune $tests $srcdir/$subdir/debug/*]
set tests [prune $tests $srcdir/$subdir/gcov/*]
set tests [prune $tests $srcdir/$subdir/special/*]
diff --git a/gcc/testsuite/lib/compat.exp b/gcc/testsuite/lib/compat.exp
new file mode 100644
index 00000000000..1965f3d6ea9
--- /dev/null
+++ b/gcc/testsuite/lib/compat.exp
@@ -0,0 +1,232 @@
+# Copyright (C) 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# This file was written by Janis Johnson, <janis187@us.ibm.com>
+
+
+# Test interoperability of two compilers that follow the same ABI, or
+# compatibility of two versions of GCC.
+#
+# Each test has a main program that does nothing but call a function,
+# plus two additional source files that contain parts of a program that
+# rely on the ABI. those source files are compiled into relocatable
+# object files with both compilers. Executables are built using various
+# combinations of those object files, with the main program compiled
+# with the compiler under test and using that compiler's runtime support.
+
+# The including .exp file must define these callback procedures.
+if [string match "" [info procs "compat-use-alt-compiler"]] then {
+ error "Proc compat-use-alt-compiler is not defined."
+}
+if [string match "" [info procs "compat-use-tst-compiler"]] then {
+ error "Proc compat-use-tst-compiler is not defined."
+}
+
+# Each test is run with each pair of compiler options from this list.
+# The first set of options in each pair is used by the compiler under
+# test, and the second set is used by the alternate compiler.
+# The default option lists can be overridden by
+# COMPAT_OPTIONS="[list [list {tst_1} {alt_1}]...[list {tst_n} {alt_n}]]"
+# where tst_i and alt_i are lists of options. You can put this in the
+# environment before site.exp is written or add it to site.exp directly.
+if ![info exists COMPAT_OPTIONS] {
+ set COMPAT_OPTIONS [list \
+ [list {} {}]]
+}
+
+set option_list $COMPAT_OPTIONS
+
+#
+# compat-obj -- compile to an object file
+#
+# SOURCE is the source file
+# DEST is the object file
+# OPTIONS is the list of compiler options
+# OPTSTR is the options to print with test messages
+#
+proc compat-obj { source dest options optstr } {
+ global testcase
+ global tool
+
+ set comp_output [${tool}_target_compile "$source" "$dest" object $options]
+ ${tool}_check_compile "$testcase $dest compile" $optstr $dest $comp_output
+}
+
+# compat-run -- link and run an executable
+#
+# TESTNAME is the mixture of object files to link
+# OBJLIST is the list of object files to link
+# DEST is the name of the executable
+# OPTIONS is a list of compiler and linker options to use
+# OPTSTR is the list of options to list in messages
+#
+proc compat-run { testname objlist dest options optstr } {
+ global testcase
+ global tool
+
+ # Check that all of the objects were built successfully.
+ foreach obj [split $objlist] {
+ if ![file exists $obj] then {
+ unresolved "$testcase $testname link $optstr"
+ unresolved "$testcase $testname execute $optstr"
+ return
+ }
+ }
+
+ # Link the objects into an executable.
+ set comp_output [${tool}_target_compile "$objlist" $dest executable \
+ "$options"]
+ if ![${tool}_check_compile "$testcase $testname link" "" \
+ $dest $comp_output] then {
+ unresolved "$testcase $testname execute $optstr"
+ return
+ }
+
+ # Run the self-checking executable.
+ set result [${tool}_load $dest "" ""]
+ set status [lindex $result 0]
+ if { $status == "pass" } then {
+ remote_file build delete $dest
+ }
+ $status "$testcase $testname execute $optstr"
+}
+
+#
+# compat-execute -- compile with compatible compilers
+#
+# SRC1 is the full pathname of the main file of the testcase.
+# USE_ALT is nonzero if we're using an alternate compiler as well as
+# the compiler under test.
+#
+proc compat-execute { src1 use_alt } {
+ global srcdir tmpdir
+ global option_list
+ global tool
+ global verbose
+ global testcase
+
+ # Use the dg-options mechanism to specify extra flags for this test.
+ # FIXME: This does not handle other uses of dg-options, and it only
+ # processes the first one.
+ set extra_tool_flags ""
+ set tmp [grep $src1 "{\[ \t\]\*dg-options.*\[ \t\]\+}"]
+ if ![string match "" $tmp] {
+ set tmp0 [lindex $tmp 0]
+ # Extract the compiler options.
+ regexp "dg-options\[ \t\]\+(.*)\[ \t\]\+\}" \
+ $tmp0 all args
+ # Sometime the options are in quotes, sometimes not.
+ regsub -all "\"" $args "" args
+ set extra_tool_flags $args
+ }
+
+ # Set up the names of the other source files.
+ regsub "_main.*" $src1 "" base
+ regsub ".*/" $base "" base
+ regsub "_main" $src1 "_x" src2
+ regsub "_main" $src1 "_y" src3
+
+ # Define the names of the object files.
+ set obj1 "main_tst.o"
+ set obj2_tst "x_tst.o"
+ set obj2_alt "x_alt.o"
+ set obj3_tst "y_tst.o"
+ set obj3_alt "y_alt.o"
+
+ # Get the base name of this test, for use in messages.
+ regsub "^$srcdir/?" $src1 "" testcase
+ regsub "_main.*" $testcase "" testcase
+ # Set up the base name of executable files so they'll be unique.
+ regsub -all "\[./\]" $testcase "-" execbase
+
+ # If we couldn't rip $srcdir out of `src1' then just do the best we can.
+ # The point is to reduce the unnecessary noise in the logs. Don't strip
+ # out too much because different testcases with the same name can confuse
+ # `test-tool'.
+ if [string match "/*" $testcase] then {
+ set testcase "[file tail [file dirname $src1]]/[file tail $src1]"
+ }
+
+ # Loop through all of the option lists used for this test.
+
+ set count 0
+ foreach option_pair $option_list {
+
+ # Pick out each set of options.
+ set tst_option [lindex $option_pair 0]
+ set alt_option [lindex $option_pair 1]
+ set optstr ""
+ if { ![string match $tst_option ""] \
+ || ![string match $alt_option ""] } then {
+ set optstr "\"$tst_option\",\"$alt_option\""
+ }
+ verbose "Testing $testcase, $optstr" 1
+
+ set tst_options ""
+ set alt_options ""
+ if ![string match $extra_tool_flags ""] then {
+ lappend tst_options "additional_flags=$extra_tool_flags $tst_option"
+ lappend alt_options "additional_flags=$extra_tool_flags $alt_option"
+ }
+
+ # There's a unique name for each executable we generate, based on
+ # the set of options and how the pieces of the tests are compiled.
+ set execname1 "${execbase}-${count}1"
+ set execname2 "${execbase}-${count}2"
+ set execname3 "${execbase}-${count}3"
+ set execname4 "${execbase}-${count}4"
+ incr count
+
+ remote_file build delete $execname1
+ remote_file build delete $execname2
+ remote_file build delete $execname3
+ remote_file build delete $execname4
+
+ # Compile pieces with the alternate compiler; we'll catch problems
+ # later. Skip this if we don't have an alternate compiler.
+ if { $use_alt != 0 } then {
+ compat-use-alt-compiler
+ compat-obj "$src2" "$obj2_alt" $alt_options $optstr
+ compat-obj "$src3" "$obj3_alt" $alt_options $optstr
+ }
+
+ # Compile pieces with the compiler under test.
+ compat-use-tst-compiler
+ compat-obj "$src1" "$obj1" $tst_options $optstr
+ compat-obj "$src2" "$obj2_tst" $tst_options $optstr
+ compat-obj "$src3" "$obj3_tst" $tst_options $optstr
+
+ # Link (using the compiler under test), run, and clean up tests.
+ compat-run "${obj2_tst}-${obj3_tst}" \
+ "$obj1 $obj2_tst $obj3_tst" $execname1 $tst_options $optstr
+
+ # If we've got an alternate compiler try some combinations.
+ if { $use_alt != 0 } then {
+ compat-run "${obj2_tst}-${obj3_alt}" "$obj1 $obj2_tst $obj3_alt" \
+ $execname2 $tst_options $optstr
+ compat-run "${obj2_alt}-${obj3_tst}" "$obj1 $obj2_alt $obj3_tst" \
+ $execname3 $tst_options $optstr
+ compat-run "${obj2_alt}-${obj3_alt}" "$obj1 $obj2_alt $obj3_alt" \
+ $execname4 $tst_options $optstr
+ }
+
+ # Clean up object files.
+ set files [glob -nocomplain *.o]
+ if { $files != "" } {
+ eval "remote_file build delete $files"
+ }
+ }
+}