From 05949e5f2cd414a43afd453273e8cab6e54e68cd Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Wed, 17 Mar 2004 10:07:30 -0800 Subject: [PATCH] re PR middle-end/14535 (exception throwing in virtual function doesn't turn on the local destructors) PR middle-end/14535 * except.c (collect_one_action_chain): Record action for cleanup outer of exception spec. From-SVN: r79592 --- gcc/ChangeLog | 6 ++++++ gcc/except.c | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ce2481323d1a..af99edc81d5d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-03-15 Richard Henderson + + PR middle-end/14535 + * except.c (collect_one_action_chain): Record action for cleanup + outer of exception spec. + 2004-03-13 Dara Hazeghi * doc/install.texi: Note status of -fnew-ra. diff --git a/gcc/except.c b/gcc/except.c index b6f851bcbfb1..b3093ce50adc 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -3292,8 +3292,18 @@ collect_one_action_chain (ar_hash, region) /* An exception specification adds its filter to the beginning of the chain. */ next = collect_one_action_chain (ar_hash, region->outer); - return add_action_record (ar_hash, region->u.allowed.filter, - next < 0 ? 0 : next); + + /* If there is no next action, terminate the chain. */ + if (next == -1) + next = 0; + /* If all outer actions are cleanups or must_not_throw, + we'll have no action record for it, since we had wanted + to encode these states in the call-site record directly. + Add a cleanup action to the chain to catch these. */ + else if (next <= 0) + next = add_action_record (ar_hash, 0, 0); + + return add_action_record (ar_hash, region->u.allowed.filter, next); case ERT_MUST_NOT_THROW: /* A must-not-throw region with no inner handlers or cleanups -- 2.47.2