From: Jakub Jelinek Date: Tue, 7 Dec 2010 15:08:54 +0000 (+0100) Subject: backport: re PR rtl-optimization/46440 (ICE: in rtl_verify_flow_info, at cfgrtl.c... X-Git-Tag: releases/gcc-4.5.2~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24fdffb866c301d1da277f38eeeb2f3ee10b08f4;p=thirdparty%2Fgcc.git backport: re PR rtl-optimization/46440 (ICE: in rtl_verify_flow_info, at cfgrtl.c:2165 with -fstack-protector-all -fno-tree-dominator-opts -fno-tree-fre) Backport from mainline 2010-11-17 Jakub Jelinek PR rtl-optimization/46440 * combine.c (update_cfg_for_uncondjump): When changing an indirect jump into unconditional jump, remove BARRIERs from bb's footer. * gcc.dg/pr46440.c: New test. From-SVN: r167539 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2d2fa0d6d31f..7d3e8a2ccab0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,13 @@ 2010-12-07 Jakub Jelinek Backport from mainline + 2010-11-17 Jakub Jelinek + + PR rtl-optimization/46440 + * combine.c (update_cfg_for_uncondjump): When changing + an indirect jump into unconditional jump, remove BARRIERs + from bb's footer. + 2010-11-16 Jakub Jelinek PR c++/46401 diff --git a/gcc/combine.c b/gcc/combine.c index 3dd5348a0cb5..9e453ec74d7f 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -2362,7 +2362,25 @@ update_cfg_for_uncondjump (rtx insn) delete_insn (insn); if (at_end && EDGE_COUNT (bb->succs) == 1) - single_succ_edge (bb)->flags |= EDGE_FALLTHRU; + { + rtx insn; + + single_succ_edge (bb)->flags |= EDGE_FALLTHRU; + + /* Remove barriers from the footer if there are any. */ + for (insn = bb->il.rtl->footer; insn; insn = NEXT_INSN (insn)) + if (BARRIER_P (insn)) + { + if (PREV_INSN (insn)) + NEXT_INSN (PREV_INSN (insn)) = NEXT_INSN (insn); + else + bb->il.rtl->footer = NEXT_INSN (insn); + if (NEXT_INSN (insn)) + PREV_INSN (NEXT_INSN (insn)) = PREV_INSN (insn); + } + else if (LABEL_P (insn)) + break; + } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4728ba4220e2..43c88f648ade 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2010-12-07 Jakub Jelinek Backport from mainline + 2010-11-17 Jakub Jelinek + + PR rtl-optimization/46440 + * gcc.dg/pr46440.c: New test. + 2010-11-16 Jakub Jelinek PR c++/46401 diff --git a/gcc/testsuite/gcc.dg/pr46440.c b/gcc/testsuite/gcc.dg/pr46440.c new file mode 100644 index 000000000000..12a99970348d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr46440.c @@ -0,0 +1,25 @@ +/* PR rtl-optimization/46440 */ +/* { dg-do compile } */ +/* { dg-options "-O -fstack-protector -fno-tree-dominator-opts -fno-tree-fre" } */ +/* { dg-require-effective-target fstack_protector } */ + +int i; + +void bar (char *); + +void +foo (void) +{ + void *l; + char c[64]; + bar (c); + i = 1; + if (i) + l = &&l1; + else + l = &&l2; + goto *l; +l2: + __builtin_abort (); +l1:; +}