summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2005-08-14 02:01:52 +0000
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2005-08-14 02:01:52 +0000
commit34dcb2fb8181f38c6471c563dcc50f7cc7860dfc (patch)
tree3986954b339cf4c36b639fae792976b61051eda5
parentef5b12be802ba23674c57c509c1151c88d443c06 (diff)
downloadgcc-34dcb2fb8181f38c6471c563dcc50f7cc7860dfc.tar.gz
libobjc/ChangeLog:
2005-08-13 Marcin Koziej <creep@desk.pl> Andrew Pinski <pinskia@physics.uc.edu> PR libobjc/22492 * exception.c (PERSONALITY_FUNCTION): Fix the PC with finally. testsuite/ChangeLog: 2005-08-13 Marcin Koziej <creep@desk.pl> Andrew Pinski <pinskia@physics.uc.edu> PR libobjc/22492 * execute/exceptions/finally-1.m: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103073 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/objc/execute/exceptions/finally-1.m45
-rw-r--r--libobjc/ChangeLog6
-rw-r--r--libobjc/exception.c12
4 files changed, 67 insertions, 2 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5169ef64fde..dff225171e7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2005-08-13 Marcin Koziej <creep@desk.pl>
+ Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR libobjc/22492
+ * execute/exceptions/finally-1.m: New test.
+
2005-08-13 Andrew Pinski <pinskia@physics.uc.edu>
* objc.dg/nested-func-1.m: Move to ...
diff --git a/gcc/testsuite/objc/execute/exceptions/finally-1.m b/gcc/testsuite/objc/execute/exceptions/finally-1.m
new file mode 100644
index 00000000000..9d4c396393e
--- /dev/null
+++ b/gcc/testsuite/objc/execute/exceptions/finally-1.m
@@ -0,0 +1,45 @@
+#include <objc/Object.h>
+
+int
+thrower_try_body()
+{
+ printf("Thrower try body\n");
+ return (0);
+}
+
+int
+finally_body()
+{
+ printf("Finally body\n");
+ return (0);
+}
+
+int
+thrower()
+{
+ @try
+ {
+ thrower_try_body();
+ @throw [Object new];
+ }
+ @finally
+ {
+ finally_body();
+ } // <----- program aborts here.
+ return 0;
+}
+
+
+int
+main(int ac, char *av[])
+{
+ @try
+ {
+ thrower();
+ }
+ @catch (id exc)
+ {
+ printf("Got exception of class %s\n", [[exc class] name]);
+ [exc free];
+ }
+}
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog
index ecd56859a85..9f623b82081 100644
--- a/libobjc/ChangeLog
+++ b/libobjc/ChangeLog
@@ -1,3 +1,9 @@
+2005-08-13 Marcin Koziej <creep@desk.pl>
+ Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR libobjc/22492
+ * exception.c (PERSONALITY_FUNCTION): Fix the PC with finally.
+
2005-08-13 Andrew Pinski <pinskia@physics.uc.edu>
* Makefile.in (extra_ldflags_libobjc): New.
diff --git a/libobjc/exception.c b/libobjc/exception.c
index cfce70c51e3..e34f34b4342 100644
--- a/libobjc/exception.c
+++ b/libobjc/exception.c
@@ -165,7 +165,8 @@ PERSONALITY_FUNCTION (int version,
const unsigned char *p;
_Unwind_Ptr landing_pad, ip;
int handler_switch_value;
- int saw_cleanup, saw_handler;
+ int saw_cleanup = 0, saw_handler;
+ void *return_object;
/* Interface version check. */
if (version != 1)
@@ -334,8 +335,15 @@ PERSONALITY_FUNCTION (int version,
}
install_context:
+ if (saw_cleanup == 0)
+ {
+ return_object = xh->value;
+ if (!(actions & _UA_SEARCH_PHASE))
+ _Unwind_DeleteException(&xh->base);
+ }
+
_Unwind_SetGR (context, __builtin_eh_return_data_regno (0),
- __builtin_extend_pointer (xh->value));
+ __builtin_extend_pointer (saw_cleanup ? xh : return_object));
_Unwind_SetGR (context, __builtin_eh_return_data_regno (1),
handler_switch_value);
_Unwind_SetIP (context, landing_pad);