aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/preserve-PPC-CR.C
diff options
context:
space:
mode:
authorno-author <no-author@gcc.gnu.org>2005-07-07 18:03:23 +0000
committerno-author <no-author@gcc.gnu.org>2005-07-07 18:03:23 +0000
commitaef20aaf8817d9630dc2ba85257219a6a50c3b17 (patch)
tree1fb63e61ae091da56a1d015fada83932555140a6 /gcc/testsuite/g++.dg/preserve-PPC-CR.C
parent5b5fcc5945558d32c619dd3047ae0ee16a6edd2f (diff)
This commit was manufactured by cvs2svn to create tagapple/gcc-5210
'apple-gcc-5210'. git-svn-id: https://gcc.gnu.org/svn/gcc/tags/apple-gcc-5210@101722 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/g++.dg/preserve-PPC-CR.C')
-rw-r--r--gcc/testsuite/g++.dg/preserve-PPC-CR.C41
1 files changed, 41 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/preserve-PPC-CR.C b/gcc/testsuite/g++.dg/preserve-PPC-CR.C
new file mode 100644
index 00000000000..38e76873ddd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/preserve-PPC-CR.C
@@ -0,0 +1,41 @@
+// APPLE LOCAL file preserve CR2 for save_world prologues
+// This testcase failed at -O2 due to a missing EH note describing the PowerPC Condition Register.
+// Thanks to Dale Johannesen.
+
+// { dg-do run }
+// { dg-options "-fpascal-strings" }
+#include <stdlib.h>
+#include <stdio.h>
+int tick = 1;
+int caught_x = 1;
+int h() { return 2; }
+void f()
+{ throw(3); }
+extern int h();
+void ff() {
+ bool xx = h() == 0;
+ if ( !xx ) {
+ try {
+ f();
+ } catch (float f) {
+ if (!xx) printf("%f\n", f);
+ }
+ }
+}
+int g(int y)
+{
+ bool x = h() != 0;
+ if ( x) {
+ try {
+ ff();
+ } catch (int ex) {
+ // if (x) printf("%d\n", ex);
+ if (x) { tick++; caught_x = ex; }
+ }}
+}
+main()
+{
+ g(3);
+ if (tick != 2 || caught_x != 3)
+ abort();
+}