diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-09-16 05:47:20 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-09-16 05:47:20 +0000 |
commit | b9f04a8461a67148848258f8e4b367a1b988038e (patch) | |
tree | 03800353a564c0cdcf3c12bb8940b28389b243a9 /libgo/runtime/go-defer.c | |
parent | fae3f4598af23b48fed264052e33d5516e31a56c (diff) | |
download | gcc-b9f04a8461a67148848258f8e4b367a1b988038e.zip gcc-b9f04a8461a67148848258f8e4b367a1b988038e.tar.gz gcc-b9f04a8461a67148848258f8e4b367a1b988038e.tar.bz2 |
Fix defer when not calling recover in function with named results.
From-SVN: r178905
Diffstat (limited to 'libgo/runtime/go-defer.c')
-rw-r--r-- | libgo/runtime/go-defer.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libgo/runtime/go-defer.c b/libgo/runtime/go-defer.c index 6425f05..1f116eb 100644 --- a/libgo/runtime/go-defer.c +++ b/libgo/runtime/go-defer.c @@ -13,7 +13,7 @@ /* This function is called each time we need to defer a call. */ void -__go_defer (void *frame, void (*pfn) (void *), void *arg) +__go_defer (_Bool *frame, void (*pfn) (void *), void *arg) { struct __go_defer_stack *n; @@ -34,7 +34,7 @@ __go_defer (void *frame, void (*pfn) (void *), void *arg) /* This function is called when we want to undefer the stack. */ void -__go_undefer (void *frame) +__go_undefer (_Bool *frame) { if (__go_panic_defer == NULL) return; @@ -53,6 +53,12 @@ __go_undefer (void *frame) __go_panic_defer->__defer = d->__next; __go_free (d); + + /* Since we are executing a defer function here, we know we are + returning from the calling function. If the calling + function, or one of its callees, paniced, then the defer + functions would be executed by __go_panic. */ + *frame = 1; } } |