From 5f77fbd46877af98e624b3b799c9ab4d49cc6891 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 2 Aug 2003 01:15:55 +0200 Subject: [PATCH] cfgcleanup.c (outgoing_edges_match): Check REG_EH_REGION notes even if nehedges1 is 0. * cfgcleanup.c (outgoing_edges_match): Check REG_EH_REGION notes even if nehedges1 is 0. * g++.dg/eh/crossjump1.C: New test. From-SVN: r70080 --- gcc/ChangeLog | 5 +++++ gcc/cfgcleanup.c | 18 +++++++++------- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/eh/crossjump1.C | 31 ++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/g++.dg/eh/crossjump1.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3122423a955..ef94a7bbad4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2003-08-01 Jakub Jelinek + + * cfgcleanup.c (outgoing_edges_match): Check REG_EH_REGION notes + even if nehedges1 is 0. + 2003-08-01 Nathanael Nerode * fixinc/fixfixes.c, fixinc/fixlib.c, fixinc/fixlib.h, diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index d03a16d88f9..1937ad03dd2 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -1337,15 +1337,17 @@ outgoing_edges_match (int mode, basic_block bb1, basic_block bb2) return false; } - /* In case we do have EH edges, ensure we are in the same region. */ - if (nehedges1) - { - rtx n1 = find_reg_note (bb1->end, REG_EH_REGION, 0); - rtx n2 = find_reg_note (bb2->end, REG_EH_REGION, 0); + /* Ensure the same EH region. */ + { + rtx n1 = find_reg_note (bb1->end, REG_EH_REGION, 0); + rtx n2 = find_reg_note (bb2->end, REG_EH_REGION, 0); - if (XEXP (n1, 0) != XEXP (n2, 0)) - return false; - } + if (!n1 && n2) + return false; + + if (n1 && (!n2 || XEXP (n1, 0) != XEXP (n2, 0))) + return false; + } /* We don't need to match the rest of edges as above checks should be enough to ensure that they are equivalent. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fef0f33d221..3bcb80febe8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2003-08-01 Jakub Jelinek + + * g++.dg/eh/crossjump1.C: New test. + 2003-08-01 Mark Mitchell PR c++/11697 diff --git a/gcc/testsuite/g++.dg/eh/crossjump1.C b/gcc/testsuite/g++.dg/eh/crossjump1.C new file mode 100644 index 00000000000..ccb0ffb2185 --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/crossjump1.C @@ -0,0 +1,31 @@ +// This testcase failed on s390, because cross-jumping merged 2 calls, +// one with REG_EH_REGION note with no handlers (ie. termination) +// and one without REG_EH_REGION note. +// { dg-do run } +// { dg-options "-O2" } + +#include +#include + +struct E : public std::exception +{ + std::string m; + E () : m ("test") { } + ~E () throw() { } +}; + +struct C : public E { }; + +void foo () +{ + throw C (); +} + +int main () +{ + try + { + foo (); + } + catch (...) { } +}