From 9dbb96fec5e08762f97dda771522283f1fe9710f Mon Sep 17 00:00:00 2001 From: krebbel Date: Thu, 17 Sep 2009 07:52:40 +0000 Subject: [PATCH] 2009-09-17 Andreas Krebbel * cfglayout.c (fixup_reorder_chain): Accept conditional jumps without a fallthrough edge. 2009-09-17 Andreas Krebbel * gcc.c-torture/compile/20090917-1.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151790 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++ gcc/cfglayout.c | 11 +++++ gcc/testsuite/ChangeLog | 4 ++ gcc/testsuite/gcc.c-torture/compile/20090917-1.c | 55 ++++++++++++++++++++++++ 4 files changed, 75 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/compile/20090917-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bbbc1bb95f7..6e4f28fa624 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2009-09-17 Andreas Krebbel + + * cfglayout.c (fixup_reorder_chain): Accept conditional jumps + without a fallthrough edge. + 2009-09-16 DJ Delorie * config/m32c/m32c.c (m32c_emit_epilogue): Check for R8C or M16C diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c index bc8ed8b7f32..d6d1b3ab697 100644 --- a/gcc/cfglayout.c +++ b/gcc/cfglayout.c @@ -787,6 +787,17 @@ fixup_reorder_chain (void) { if (any_condjump_p (bb_end_insn)) { + /* This might happen if the conditional jump has side + effects and could therefore not be optimized away. + Make the basic block to end with a barrier in order + to prevent rtl_verify_flow_info from complaining. */ + if (!e_fall) + { + gcc_assert (!onlyjump_p (bb_end_insn)); + bb->il.rtl->footer = emit_barrier_after (bb_end_insn); + continue; + } + /* If the old fallthru is still next, nothing to do. */ if (bb->aux == e_fall->dest || e_fall->dest == EXIT_BLOCK_PTR) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1f1bc17e5f8..1a24f25c706 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2009-09-17 Andreas Krebbel + + * gcc.c-torture/compile/20090917-1.c: New testcase. + 2009-09-16 Uros Bizjak * gfortran.dg/default_format_denormal_2.f90: Add ieee options. diff --git a/gcc/testsuite/gcc.c-torture/compile/20090917-1.c b/gcc/testsuite/gcc.c-torture/compile/20090917-1.c new file mode 100644 index 00000000000..2b8c37148bd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090917-1.c @@ -0,0 +1,55 @@ +typedef int *loop_p; +typedef struct VEC_loop_p_base +{ + unsigned num; + loop_p vec[1]; +} +VEC_loop_p_base; + +__inline__ int +VEC_loop_p_base_iterate (const VEC_loop_p_base * vec_, unsigned ix_, + loop_p * ptr) +{ + if (vec_ && ix_ < vec_->num) + { + *ptr = vec_->vec[ix_]; + return 1; + } + else + { + return 0; + } +} + +typedef struct VEC_loop_p_heap +{ + VEC_loop_p_base base; +} +VEC_loop_p_heap; + + +static __inline__ int +am_vector_index_for_loop (VEC_loop_p_heap * loop_nest, int loop_num) +{ + int i; + loop_p l; + + for (i = 0; + VEC_loop_p_base_iterate ((loop_nest) ? &(loop_nest)->base : 0, i, + &(l)); i++) + if (l == loop_num) + return i; + + __builtin_unreachable (); +} + +unsigned char +build_access_matrix (unsigned max) +{ + unsigned i; + for (i = 0; i < max; i++) + { + if (am_vector_index_for_loop (foo (), 0)) + return 0; + } +} -- 2.11.4.GIT