From 7cbd12b88f5749676e888502453056fcc48cd61e Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 17 May 2005 08:48:19 +0200 Subject: [PATCH] re PR middle-end/21492 (ICE in try_crossjump_to_edge) PR middle-end/21492 * cfgcleanup.c (try_crossjump_to_edge): update_forwarder_flag for src2 if src2 has been split. * g++.dg/opt/crossjump1.C: New test. From-SVN: r99816 --- gcc/ChangeLog | 4 ++++ gcc/cfgcleanup.c | 2 ++ gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/opt/crossjump1.C | 33 +++++++++++++++++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 gcc/testsuite/g++.dg/opt/crossjump1.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 99e010889bc..dc64af228ba 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2005-05-17 Jakub Jelinek + PR middle-end/21492 + * cfgcleanup.c (try_crossjump_to_edge): update_forwarder_flag for + src2 if src2 has been split. + PR tree-optimization/21610 * c-typeck.c (decl_constant_value_for_broken_optimization): If not returning DECL, call unshare_expr. diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index e7df2aeece6..10e6f101eed 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -1677,6 +1677,8 @@ try_crossjump_to_edge (int mode, edge e1, edge e2) delete_basic_block (to_remove); update_forwarder_flag (redirect_from); + if (redirect_to != src2) + update_forwarder_flag (src2); return true; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e6911746563..2428cf14f36 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2005-05-17 Jakub Jelinek + PR middle-end/21492 + * g++.dg/opt/crossjump1.C: New test. + PR tree-optimization/21610 * gcc.c-torture/compile/20050516-1.c: New test. diff --git a/gcc/testsuite/g++.dg/opt/crossjump1.C b/gcc/testsuite/g++.dg/opt/crossjump1.C new file mode 100644 index 00000000000..3bb95d1810c --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/crossjump1.C @@ -0,0 +1,33 @@ +// PR middle-end/21492 +// { dg-do compile } +// { dg-options "-Os -fPIC" } + +extern char *bar (const char *, const char *); +extern char *baz (char *, const char *); +extern unsigned int fn (const char *); +static const struct C { int i; } k = { 0}; + +struct A +{ + ~A (); +}; + +char * +foo (char *x, const char *y) +{ + A a; + char *c = x; + + if (bar (y, "foo")) + { + baz (c, "foo"); + c += fn ("foo"); + } + else if (bar (y, "bar")) + { + baz (c, "bar"); + c += fn ("bar"); + } + + return x; +}