Commit 9fcaf059 by Segher Boessenkool Committed by Segher Boessenkool

cfgrtl: Don't crash in rtl_dump_bb if BB_END(bb) is NULL

Currently rtl_dump_bb crashes if BB_END(bb) is NULL, like it can be
during expand (rtl_dump_bb can be called at any time, by the emergency
dump added recently for example).

This fixes it.


	* cfgrtl.c (rtl_dump_bb): Don't call NEXT_INSN on NULL.

From-SVN: r250480
parent d47d34bb
2017-07-24 Segher Boessenkool <segher@kernel.crashing.org>
* cfgrtl.c (rtl_dump_bb): Don't call NEXT_INSN on NULL.
2017-07-24 Wilco Dijkstra <wdijkstr@arm.com> 2017-07-24 Wilco Dijkstra <wdijkstr@arm.com>
PR target/79041 PR target/79041
......
...@@ -2109,8 +2109,6 @@ commit_edge_insertions (void) ...@@ -2109,8 +2109,6 @@ commit_edge_insertions (void)
static void static void
rtl_dump_bb (FILE *outf, basic_block bb, int indent, dump_flags_t flags) rtl_dump_bb (FILE *outf, basic_block bb, int indent, dump_flags_t flags)
{ {
rtx_insn *insn;
rtx_insn *last;
char *s_indent; char *s_indent;
s_indent = (char *) alloca ((size_t) indent + 1); s_indent = (char *) alloca ((size_t) indent + 1);
...@@ -2124,18 +2122,22 @@ rtl_dump_bb (FILE *outf, basic_block bb, int indent, dump_flags_t flags) ...@@ -2124,18 +2122,22 @@ rtl_dump_bb (FILE *outf, basic_block bb, int indent, dump_flags_t flags)
} }
if (bb->index != ENTRY_BLOCK && bb->index != EXIT_BLOCK) if (bb->index != ENTRY_BLOCK && bb->index != EXIT_BLOCK)
for (insn = BB_HEAD (bb), last = NEXT_INSN (BB_END (bb)); insn != last; {
insn = NEXT_INSN (insn)) rtx_insn *last = BB_END (bb);
{ if (last)
if (flags & TDF_DETAILS) last = NEXT_INSN (last);
df_dump_insn_top (insn, outf); for (rtx_insn *insn = BB_HEAD (bb); insn != last; insn = NEXT_INSN (insn))
if (! (flags & TDF_SLIM)) {
print_rtl_single (outf, insn); if (flags & TDF_DETAILS)
else df_dump_insn_top (insn, outf);
dump_insn_slim (outf, insn); if (! (flags & TDF_SLIM))
if (flags & TDF_DETAILS) print_rtl_single (outf, insn);
df_dump_insn_bottom (insn, outf); else
} dump_insn_slim (outf, insn);
if (flags & TDF_DETAILS)
df_dump_insn_bottom (insn, outf);
}
}
if (df && (flags & TDF_DETAILS)) if (df && (flags & TDF_DETAILS))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment