Skip to content

Commit

Permalink
libobjc/ChangeLog:
Browse files Browse the repository at this point in the history
2005-08-13  Marcin Koziej  <[email protected]>
            Andrew Pinski  <[email protected]>

	PR libobjc/22492
	* exception.c (PERSONALITY_FUNCTION): Fix the PC with finally.

testsuite/ChangeLog:
2005-08-13  Marcin Koziej  <[email protected]>
            Andrew Pinski  <[email protected]>

	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
  • Loading branch information
pinskia committed Aug 14, 2005
1 parent ef5b12b commit 34dcb2f
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 2 deletions.
6 changes: 6 additions & 0 deletions gcc/testsuite/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2005-08-13 Marcin Koziej <[email protected]>
Andrew Pinski <[email protected]>

PR libobjc/22492
* execute/exceptions/finally-1.m: New test.

2005-08-13 Andrew Pinski <[email protected]>

* objc.dg/nested-func-1.m: Move to ...
Expand Down
45 changes: 45 additions & 0 deletions gcc/testsuite/objc/execute/exceptions/finally-1.m
Original file line number Diff line number Diff line change
@@ -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];
}
}
6 changes: 6 additions & 0 deletions libobjc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2005-08-13 Marcin Koziej <[email protected]>
Andrew Pinski <[email protected]>

PR libobjc/22492
* exception.c (PERSONALITY_FUNCTION): Fix the PC with finally.

2005-08-13 Andrew Pinski <[email protected]>

* Makefile.in (extra_ldflags_libobjc): New.
Expand Down
12 changes: 10 additions & 2 deletions libobjc/exception.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 34dcb2f

Please sign in to comment.