diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-01-14 21:01:18 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-01-14 21:01:18 +0000 |
commit | 618fa93ee154ec512957f06f114a2e4b8dfe8b31 (patch) | |
tree | eecbca2a732677a298b0d3f9d1df202471749812 /gcc/except.c | |
parent | 2c3c651e839533a7f3b1bee9376f51fab6d8bfad (diff) | |
download | ppe42-gcc-618fa93ee154ec512957f06f114a2e4b8dfe8b31.tar.gz ppe42-gcc-618fa93ee154ec512957f06f114a2e4b8dfe8b31.zip |
PR c++/12491
* except.c (struct eh_region): Add u.fixup.resolved.
(resolve_one_fixup_region): Split out from ...
(resolve_fixup_regions): ... here.
* g++.dg/eh/cleanup2.C: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@75883 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/except.c')
-rw-r--r-- | gcc/except.c | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/gcc/except.c b/gcc/except.c index 1468d3b909f..b735cc1aef3 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -189,6 +189,7 @@ struct eh_region GTY(()) struct eh_region_u_fixup { tree cleanup_exp; struct eh_region *real_region; + bool resolved; } GTY ((tag ("ERT_FIXUP"))) fixup; } GTY ((desc ("%0.type"))) u; @@ -890,29 +891,49 @@ collect_eh_region_array (void) } static void +resolve_one_fixup_region (struct eh_region *fixup) +{ + struct eh_region *cleanup, *real; + int j, n; + + n = cfun->eh->last_region_number; + cleanup = 0; + + for (j = 1; j <= n; ++j) + { + cleanup = cfun->eh->region_array[j]; + if (cleanup && cleanup->type == ERT_CLEANUP + && cleanup->u.cleanup.exp == fixup->u.fixup.cleanup_exp) + break; + } + if (j > n) + abort (); + + real = cleanup->outer; + if (real && real->type == ERT_FIXUP) + { + if (!real->u.fixup.resolved) + resolve_one_fixup_region (real); + real = real->u.fixup.real_region; + } + + fixup->u.fixup.real_region = real; + fixup->u.fixup.resolved = true; +} + +static void resolve_fixup_regions (void) { - int i, j, n = cfun->eh->last_region_number; + int i, n = cfun->eh->last_region_number; for (i = 1; i <= n; ++i) { struct eh_region *fixup = cfun->eh->region_array[i]; - struct eh_region *cleanup = 0; - if (! fixup || fixup->type != ERT_FIXUP) + if (!fixup || fixup->type != ERT_FIXUP || fixup->u.fixup.resolved) continue; - for (j = 1; j <= n; ++j) - { - cleanup = cfun->eh->region_array[j]; - if (cleanup && cleanup->type == ERT_CLEANUP - && cleanup->u.cleanup.exp == fixup->u.fixup.cleanup_exp) - break; - } - if (j > n) - abort (); - - fixup->u.fixup.real_region = cleanup->outer; + resolve_one_fixup_region (fixup); } } |